Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2006

Tip: Looking for answers? Try searching our database.

how to includes font into a marcro?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Parise - 02 Oct 2006 18:35 GMT
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
Doug Robbins - Word MVP - 02 Oct 2006 18:50 GMT
Show us the code that you have generated and explain what it is supposed to
do.

Signature

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

> 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
Parise - 02 Oct 2006 20:26 GMT
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.

> Show us the code that you have generated and explain what it is supposed to
> do.
[quoted text clipped - 5 lines]
> >
> > Thanks
Jean-Guy Marcil - 02 Oct 2006 22:04 GMT
Parise was telling us:
Parise nous racontait que :

> Ok I have to write:
>
[quoted text clipped - 6 lines]
> 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
'_______________________________________

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.