Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want a way of updating all fields in a Word 2013 document. (If it works in other versions, all the better; I originally had this problem with Word 2007, and nothing seems to have changed since then.) This includes cross-references, page numbers, tables of contents, indexes, headers, etc. If it can be updated by pressing F9, I want it updated.

(In theory updating fields can cause other fields to need updating, e.g. a longer table of contents changes some page numbers in the main text. Taking care of the common cases is good enough for me. In fact, it's ok if I have to run the macro two or three times before it stabilizes. I just want to have a single macro that finds everything.)

My attempt so far doesn't update fields in text boxes inside figures. How do I update them, and what else have I missed?

EDIT: Combining the answer given with what I already had gives a macro that seems to update everything (with a known defect).

'' Update all the fields, indexes, etc. in the specified document.
Sub UpdateAllFieldsIn(doc As Document)
    '' Update tables. We do this first so that they contain all necessary
    '' entries and so extend to their final number of pages.
    Dim toc As TableOfContents
    For Each toc In doc.TablesOfContents
    Next toc
    Dim tof As TableOfFigures
    For Each tof In doc.TablesOfFigures
    Next tof
    '' Update fields everywhere. This includes updates of page numbers in
    '' tables (but would not add or remove entries). This also takes care of
    '' all index updates.
    Dim sr As range
    For Each sr In doc.StoryRanges
        While Not (sr.NextStoryRange Is Nothing)
            Set sr = sr.NextStoryRange
            '' FIXME: for footnotes, endnotes and comments, I get a pop-up
            '' "Word cannot undo this action. Do you want to continue?"
    Next sr
End Sub
'' Update all the fields, indexes, etc. in the active document.
'' This is a parameterless subroutine so that it can be used interactively.
Sub UpdateAllFields()
    UpdateAllFieldsIn ActiveDocument
End Sub
share|improve this question
For completeness you may also want to add the table of authorities: Dim toa As Word.TableOfAuthorities / For Each toa In ActiveDocument.TablesOfAuthorities / toa.Update / Next – Terrance Feb 14 '13 at 19:29
Just a heads up that I tried this in Word 2013, and confirming that it still works. Thank you very much @Gilles for providing the code! – Ugo May 26 at 9:48
What about a macro that goes to print preview and back to the document? – Pedro77 Aug 7 at 12:57
@Pedro77 How is that supposed to help? At least with Word 2013 (I no longer have access to Word 2007), going to print preview, or for that matter printing, doesn't update fields. – Gilles Aug 7 at 14:17
My fields are updated, at least references and cross-reference fields. – Pedro77 Aug 7 at 18:08

5 Answers 5

up vote 2 down vote accepted

Go into the print settings, select update fields. Then go to print, or print preview your doc. Et viola, all fields are updated.

MS Word Print Options from Word of Mac 2016

share|improve this answer
Working for me now in Word 2010 (where the setting is in“File → Options → Display”). In fact without the option some fields are updated but not all. I'm pretty sure it didn't in Word 2007 but I no longer have it to test. – Gilles Sep 15 at 14:51
I'm on Word 2016 for Mac. The setting is in Word -> Preferences -> Print. But on widows it will in the print section of the global settings. I'm sure I've been there in the past, but I don't have an install to test with right now. – David Roussel Sep 15 at 15:55

I just do Ctrl+A - to select everything - and then F9 to update the lot.

Although, this misses headers and footers, but they update when you print/print-preview IIRC.


I've found the following macro. On a quick test it updated tables of contents, fields within paragraphs, fields within the header and footer, and fields within a floating text box figure.

Hopefully that covers everything that you need, if not please indicate what is still failing to update.


Sub UpdateAll()
    Dim oStory As Range
    For Each oStory In ActiveDocument.StoryRanges
        If oStory.StoryType <> wdMainTextStory Then
            While Not (oStory.NextStoryRange Is Nothing)
                Set oStory = oStory.NextStoryRange
        End If
    Next oStory
    Set oStory = Nothing
End Sub
share|improve this answer
@Giles - OK, fair enough, always best to check that the basics have been explored first. I've just now had a hunt and found a macro that seems to do the job, check my update, let me know if it misses anything. – DMA57361 Oct 7 '10 at 8:10
Now we're talking! I have no idea why iterating with NextStoryRange and with document.StoryRanges are different things, but your code combined with the table updates I already had make up a winner (well, almost, but that's a different issue). – Gilles Oct 7 '10 at 19:02

This page looks interesting:

If you are using Word 2007, the process is a bit different: Click the Office button and then click Word Options. Word displays the Word Options dialog box. Click on Advanced at the left side of the dialog box. (Click here to see a related figure.) In the General area (scroll down a bit to see it), make sure the Update Automatic Links at Open check box is selected. Click on OK. That setting should make sure that all your links are always up to date. If you want to update the fields when the document is opened, you'll need to use a macro to accomplish the task. Specifically, you'll need to use either an AutoOpen or AutoClose macro, depending on whether you want to update the fields when the document opens or closes. The following is an example of an AutoOpen macro you can use.

Sub AutoOpen()
    With Options
        .UpdateFieldsAtPrint = True
        .UpdateLinksAtPrint = True
    End With
End Sub

Note that the macro makes sure that the options are set to force updating the fields and links when printing occurs, then it updates all the members of the Fields collection in the document. If you, instead, wanted to update the fields at closing, you could use this macro:

Sub AutoClose()
End Sub

This macro is much shorter because there is no need to set the update-on-print options when you are exiting the document.exiting the document.

share|improve this answer

Word 2010:

Right click the ribbon, customise the ribbon, choose command from "all commands" search for "update" and add it where you want.

This button updates only selected fields.
Then, to update all fields, press Ctrl + A then this button.

share|improve this answer
How does it differ from pressing F9? Does that really update inside figures, tables, etc? – Gilles Jul 18 '13 at 19:44
I now have Word 2013, so I checked. This appears to do the same as pressing F9. It doesn't update fields inside figures, which was my main motivation for asking this question. – Gilles Aug 7 at 14:13

If you want to properly update all headers and footers, this worked for me:

    Dim oStory As Range
    Dim oSection As Object
    Dim oHeader As Object
    Dim oFooter As Object

    For Each oStory In ActiveDocument.StoryRanges
    Next oStory

        For Each oSection In ActiveDocument.Sections
             For Each oHeader In oSection.Headers
             Next oHeader

             For Each oFooter In oSection.Footers
             Next oFooter
        Next oSection
share|improve this answer
How does this improve on the accepted answer? Does it update fields in text boxes in figures? – Gilles Feb 18 at 20:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.