Hi,
I have about 400 Word documents which all use the same set of MergeFields in different layouts.
I need to figure out a way to write a macro which will loop through all the MergeFields in a doc and set the "Preserve formatting during updates" checkbox.
When I manually did this for a field and recorded a macro, the code that got generated was:
WordBasic.FormatField Field:="MERGEFIELD ReqDate "
...which didn't really help since it created a new field when I ran it.
Is there any way I can do this
Thanks,
JGP

Challenge writing a macro for setting Mergefields properties
Kamii47
OK, so this hack seems to work for me in Word 2003, but I can't claim any "best-practice-ness" about it. So take it with a caveat that further testing may be required...
Const cMergeFormat = " \* MERGEFORMAT "
Dim fld As Word.Field
For Each fld In ActiveDocument.Fields
If Right(fld.Code.Text, Len(cMergeFormat)) <> cMergeFormat Then
fld.Code.Text = fld.Code.Text & cMergeFormat
End If
Next fld
If you are using mail merge in your 400 word documents the collection in the for loop may have to be ActiveDocument.MailMerge.Fields instead of ActiveDocument.Fields
Happy coding!
rusty