Word 2013 pageref fields set to update on document open results in incorrect values

282 Views Asked by At

I have a document in word that has a pageref field pointing to a bookmark on another page. When I create the field, it shows the correct value (let's say page 4). I then enter content before page 4, pushing the content to page 5. I then try an automated way to update fields (a macro run on document open, or the updateFields tag entered into the document's settings file) and in both cases, the field is updated to an incorrect value. I have not been able to get correct values into the field except by updating the field after the document is already open.

Is this a known issue? Do I have some weird issues with my installation of Word 2013? Does anyone have an idea on how I can update the fields (preferrably without a macro) without needing the user to take an action?

edit: To clarify how I am generating this document: It was originally an openxml generated document, but this behavior is repeatable with a new word document created via word

the pageref fields update to incorrect values whether the update is done via macro, or word settings. See below for the macro I tried. Also note, that If I manually run this macro AFTER the document has opened, the fields update with correct values

Sub AutoOpen()
With Options
    .UpdateFieldsAtPrint = True
    .UpdateLinksAtPrint = True
End With
ActiveDocument.Fields.Update
End Sub
0

There are 0 best solutions below