Aug 13 2008

MS Word: update all field codes in comments

No Gravatar

WHEN IT COMES to power users Microsoft Word, the web boasts quite a bit of source code to update all field codes in a document. See Curtis Keisler‘s blog for a great example. But what if you need to update a slew of field codes in comments? This VBA snippet does it for you:


Dim oStory As Range
Dim oField As Field
For Each oStory In ActiveDocument.StoryRanges
For Each oField In oStory.Fields
oField.Update
Next oField
Next oStory
For Each comm In ActiveDocument.Comments
comm.Range.Select
Selection.Fields.Update
Next comm

Share