Hi
I have some VBA that opens all Word documents in a given folder, pastes their content into a blank template then saves with the original filename in a new folder.
As part of this I want the filename field in the header of the new documents to automatically update with the document filename. I nknwo you can use F9 but I don't want this to be a task for the document users.
I've seen some vba examples such as:
Code:
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
but these all appear in their own sub routines and when I try to add it to my exisiting code it doesn't work.
I'd really appreciate any pointers on how to solve this, thanks.