clhare
08-04-2009, 08:06 AM
I have a document that uses the SAVEDATE field (both in the text and the footers) and the FILENAME field (used only in the footers). I have set the FILENAME fields to include the file path.
I am trying to get all these fields to update automatically when the document is opened. I have put the following code in ThisDocument:
Private Sub Document_Open()
Dim aStory As Range
Dim aField As Field
' Automatically update all fields in document when it is opened
For Each aStory In ActiveDocument.StoryRanges
For Each aField In aStory.Fields
aField.Update
Next aField
Next aStory
End Sub
When I test the document by changing the date in the date fields and then saving/closing then moving it to another folder, I find that the dates are updating correctly but the folder is not. How do I get the FILENAME field to update in all the footers?
I am trying to get all these fields to update automatically when the document is opened. I have put the following code in ThisDocument:
Private Sub Document_Open()
Dim aStory As Range
Dim aField As Field
' Automatically update all fields in document when it is opened
For Each aStory In ActiveDocument.StoryRanges
For Each aField In aStory.Fields
aField.Update
Next aField
Next aStory
End Sub
When I test the document by changing the date in the date fields and then saving/closing then moving it to another folder, I find that the dates are updating correctly but the folder is not. How do I get the FILENAME field to update in all the footers?