Hi
To ensure an update before printing, do Tools > Options > Print and tick
Update Fields.
To ensure an update before saving requires a macro. You can put a macro in a
document, but that's rarely a good idea, because it will always trigger a
macro warning unless you have macro security set to low, and that setting is
itself not a good idea.
If your document is based on a specific template, then put the following
code in that template. If you do that, then the macro will run whenever you
save documents based on that template.
Alternatively, create a template to do nothing but hold this code and put
that template in your Word startup folder (as shown at Tools > Options >
File Locations > Start Up). The template will load automatically as an
add-in whenever you start Word. If you do this, then the macro will run
whenever you save any document.
Here's the code I routinely use to override the File > Save and File >
SaveAs commands and update all fields before saving:
Sub FileSave()
'
' FileSave Macro
' Saves the active document or template
'
UpdateAll ActiveDocument
ActiveDocument.Save
End Sub
Sub FileSaveAs()
'
' FileSaveAs Macro
' Saves a copy of the document in a separate file
'
Dialogs(wdDialogFileSaveAs).Show
UpdateAll ActiveDocument
ActiveDocument.Save
End Sub
Private Function UpdateAll(oDocument As Document) As Boolean
'Author: Graham Mayor, Microsoft MVP, 2003
'
http://www.gmayor.dsl.pipex.com/installing_macro.htm
'Modified by Shauna Kelly,
www.ShaunaKelly.com, 2003
Dim oStory As Range
Dim oTOC As TableOfContents
For Each oStory In oDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
For Each oTOC In ActiveDocument.TablesOfContents
'Oh mystery of life: why does *.Fields.Update not
'always update TOC fields? I don't know.
'But we need to do the TOCs explicitly.
oTOC.Update
Next oTOC
Set oStory = Nothing
Set oTOC = Nothing
End Function
Hope this helps.
Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word