22Dec/0410
Refresh Fields in Microsoft Word
The concept of having page numbers and other fields in Word to dynamically display information works and sounds great. The only drawback is getting the information to stay up to date. Yes, there is the F9 feature that refreshes all the selected fields. Having to remember to select all the text and then press F9 is not bad. But the headers and footers are not selected so they do not get updated. Each different header needs to be updated individually. This macro will update all the fields in each section of the active document.
Create Macro
- Select Tools - Macro - Macros from the menu bar
- Enter RefreshAllFields for the 'Macro Name'
- Select 'Normal.doc' for 'Macros in'
- Select 'Create' option
- Copy the following text between Sub and End Sub
- Paste into Visual Basic Editor

Sub RefreshAllFields() ' ' RefreshAllFields Macro ' ' For i = 1 To ActiveDocument.Sections.Count If Not ActiveDocument.Sections(i).Headers Is Nothing Then For h = 1 To ActiveDocument.Sections(i).Headers.Count x = ActiveDocument.Sections(i).Headers(h).Range.Fields.Update() Next h End If x = ActiveDocument.Range.Fields.Update() If Not ActiveDocument.Sections(i).Footers Is Nothing Then For f = 1 To ActiveDocument.Sections(i).Footers.Count x = ActiveDocument.Sections(i).Footers(f).Range.Fields.Update() Next f End If Next i End Sub
Run Macro
- Select Tools - Macro - Macros from the menu bar
- Select RefreshAllFields for List of macros
- Sit back and watch
I use this macro so often that I added it to my personal toolbar that is always displayed in every document.