Tag: Update

  • Update All Fields In MS Word

    Sometimes you find a feature in a product that is just blatantly missing. One of those in Microsoft Word is the ability to update all the fields in the document with the latest value in a field.

    I use both the built in fields e.g. Author, Version, Title and custom fields e.g. Project Code. I set the values once in the document properties and then insert the field codes in the document rather than the text. All is well. If you change the value of a field you can press F9 and all of the fields update to the latest value EXCEPT if you have used the fields in the document header or footer, these do not get updated for some reason. I would classify this as a bug, why would I not want all instances of the same field to be in sync throughout my document.

    The solution is remarkably simple. Create the following macro:

    Sub UpdateAll()
    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
    End Sub

    This can be saved in your normal.dot file and will be available in all your word documents.