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

'
' RefreshAllFields Macro
'
'
Next h
End If
x = ActiveDocument.Range.Fields.Update()
If Not ActiveDocument.Sections(i).Footers Is Nothing Then
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.
December 12th, 2007 - 15:59
Thanks very much for the macro! Came in very handy.
April 23rd, 2008 - 02:33
I suppose I misunderstand the purpose of this macro.
I have tables in my document that give an overview of each chapter. They contain fields linked to bookmarks, which display the page number in the table. These page numbers don’t update as I edit the document, so I have to go to each “overview” table and manually right-click and select “update field.”
This macro doesn’t update those fields.
May 11th, 2008 - 13:20
Tuck,
the page numbers won’t update as you edit the document. They will update when you run the macro. It’s automates the right-clicking and selecint “update field” that you are doing.
I’ve tried other similar scripts but somehow they all mess up some references. This seems to work the best so far.
May 17th, 2008 - 15:30
Thanks for this macro, worked to a tea.
May 21st, 2008 - 14:42
Do you know a way to run this marco automatically when the Word document opens?
Alex
May 27th, 2008 - 06:20
I am sure that there is a way, but I have not tried it.
June 11th, 2008 - 09:34
Amazing! macro. This saved me a days worth of work! Whew!!! Super!
July 15th, 2008 - 08:48
This works for fields… but in a graphic rich document with lots of pasted screenshots, it will update every picture to be ONLY ONE picture, resized for each occurrence. I’ve tried a number of methods myself, but all such macros seem to do this…
Any way to filter out images when iterating through?
February 5th, 2009 - 11:02
thank you thank you thank you thank you!!!
April 15th, 2009 - 05:38
Is there a special reason you write so many loops?
I guess this would be enough:
ActiveDocument.Fields.Update