View Single Post
 
Old 03-02-2011, 12:14 PM
rhatx rhatx is offline Windows 7 64bit Office 2007
Novice
 
Join Date: Mar 2011
Location: Austin, Texas
Posts: 1
rhatx is on a distinguished road
Default Macro to update fields

Need help with this issue. We use a macro to automatically update fields in our documents. It works great except when you open a second document then the update fails and I get "Error! Not a valid file name" in the field. This failure happens 98% of the time, but sometimes it doesn't.
If I open the second file by itself the macro works fine.
This is the macro that I downloaded to update the fields upon opening the files:
Sub Document_Open()
Dim aStory As Range
Dim aField As Field
For Each aStory In ActiveDocument.StoryRanges
For Each aField In aStory.Fields
aField.Update
Next aField
Next aStory
End Sub

Our typical field is as follows:
{INCLUDETEXT "spec project info.docx" projheader}

Any ideas?
Reply With Quote