View Single Post
 
Old 05-27-2016, 04:24 PM
Stefan Blom's Avatar
Stefan Blom Stefan Blom is offline Windows 7 64bit Office 2013
Moderator
 
Join Date: Aug 2011
Posts: 4,005
Stefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to allStefan Blom is a name known to all
Default

You can use the following macro, created by MVP Graham Mayor, to update all fields on document open:

Code:
Sub AutoOpen()
'Code created by MVP Graham Mayor
Dim oStory As Range
For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
lbl_Exit:
Set oStory = Nothing
Exit Sub
End Sub
Press Alt+F11 to display the Visual Basic Editor. Click View | Project Explorer. Click to select "Normal." Click Insert | Module. Paste in the macro above into the module you just created. Click the Save button on the toolbar. Close the Visual Basic Editor.

Exit and restart Word when you are done.
__________________
Stefan Blom
Microsoft Word MVP

Microsoft 365 apps for business
Windows 11 Professional
Reply With Quote