Format field inserted with VBA

K

kheisler6

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.

###
 
M

macropod

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
 

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