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 / Mailmerge and Fax / December 2005

Tip: Looking for answers? Try searching our database.

Format field inserted with VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kheisler6@cox.net - 19 Dec 2005 19:09 GMT
I'm new to VBA in word, but I assume this should be easy. I'm using VBA
to set up a mailmerge and insert certain fields. How do I edit the code
to apply formatting to some of the fields? For example, in the lines
below, I would like the JournalDate field to be in italics.

Thank you.

###

With MainDoc.Fields

   .Add Word.Selection.Range, Word.WdFieldType.wdFieldMergeField,
"AuthorList", False
   'Selection.TypeText " "
   .Add Word.Selection.Range, Word.WdFieldType.wdFieldMergeField,
"JournalDate", False
   'Selection.TypeText " "

   etc.

###
macropod - 21 Dec 2005 11:26 GMT
You'll need to either format the whole field, or insert a \* Charformat
switch then format the first character of the field (ie the 'M' in
'MAILMERGE'). Either way, you'll have to apply the italics after inserting
the field.

Cheers

> I'm new to VBA in word, but I assume this should be easy. I'm using VBA
> to set up a mailmerge and insert certain fields. How do I edit the code
[quoted text clipped - 17 lines]
>
> ###
 
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.