Right now, I have spent a whole afternoon trying to unsuccessfully fix a Word bug. I am using Word 365 for Mac.
I need to add a certain verbiage at the end of my official translationw, naming the date and the number of pages of the document. While the date field gets updated every time I open the file, the NUMPAGES field does not (nor does DOCPROPERTY PAGES)
I have tried to add a macro to force to update all fields upon open, however it only updates the page count to 3. I am not sure why, and I find it absurd to spend hours trying to fix something so basic.
Whenever I print the file, the fields get updated as I have checked the corresponding option in the settings.
Code
Sub AutoOpen()
'
' AutoOpen Macro
' Macro that update document fields on Open
Dim aStory As Range Dim aField As Field
For Each aStory In ActiveDocument.StoryRanges
For Each aField In aStory.Fields aField.Update Next aField
Next aStory
End Sub
Display More
An alternative code I tried and that is not working, either is: