Path and filenames in footers

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have numerous Word files where I insert the path and filename in the
footer. These files are updated weekly and saved as a new filename with a
different date. The filename doesn't automatically change in the footer when
I do a save as with the new date.
 
Hi Graham,

I am being completely stupid here but I followed your link and got the macro
to update which works fine but I want to run it when the document is opened
but I cant figure out how to add AutoOpen into that Macro - what would you
suggest? In case you cant tell I'm no VBA expert...

Thanks

Ed
 
Just change the name of the UpdateAll macro to AutoOpen and make sure to
store it in the Normal template:

Sub AutoOpen()
Dim oStory As Range
For Each oStory In ActiveDocument.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
Set oStory = Nothing
End Sub

Any fields in any document opened in Word will then update.

A possible side-effect is that it will take longer time to open documents
(especially long documents with many fields).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top