how to includes font into a marcro?

P

Parise

Hi, i'm trting to do a macro. It is working but I can't put differend font
and size of text. When I doing my macro after it has record, the font and
size is the same as by text just after it.

Thanks
 
D

Doug Robbins - Word MVP

Show us the code that you have generated and explain what it is supposed to
do.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
P

Parise

Ok I have to write:

Cette recette vous est offerte par

my name (in Old English size 14)
my student number (in Courrier New size 8)

I can't put the fonts I need to. Well I can decide that I want a sentence
in a font, but when I do my macro it doesn't sho the font I choose.
 
J

Jean-Guy Marcil

Parise was telling us:
Parise nous racontait que :
Ok I have to write:

Cette recette vous est offerte par

my name (in Old English size 14)
my student number (in Courrier New size 8)

I can't put the fonts I need to. Well I can decide that I want a
sentence in a font, but when I do my macro it doesn't sho the font I
choose.

Doug asked you to show us the code you have so far.
Without that, it is difficult to offer help, and whatever help offered might
be a stab in the dark and be useless.

In any case, here is something to get you started:

'_______________________________________
Dim rgeToInsert As Range

Set rgeToInsert = Selection.Range

With rgeToInsert
'In case the selection is a range,
'collapse it to the start
.Collapse wdCollapseStart
'Insert the first text and some carriage returns
'and collpase to the end
.InsertAfter "Cette recette vous est offerte par" _
& vbCrLf & vbCrLf
.Collapse wdCollapseEnd
'Insert next sentence
.InsertAfter "My Name" & vbCrLf
With .Font
.Name = "Old English"
.Size = 14
End With
.Collapse wdCollapseEnd
'Insert next sentence
.InsertAfter "My Number" & vbCrLf
With .Font
.Name = "Courier"
.Size = 8
End With
End With
'_______________________________________

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top