Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Autoupdate field name when i change the file name
I want to insert a field which is the file name.
But I want the field to be automatically updated when I change the file name, instead of updateiing the field manually every time? Is this possible? Also if possible can I do the same for a footer field? |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Autoupdate field name when i change the file name
To automate this, you would have to intercept the FileSaveAs command.
The following example uses Graham Mayor's macro to update all fields (see http://gmayor.com/installing_macro.htm): Sub FileSaveAs Dim oStory As Range Dialogs(wdDialogFileSaveAs).Show 'Added line... 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 -- Stefan Blom Microsoft Word MVP "MK" wrote in message ... I want to insert a field which is the file name. But I want the field to be automatically updated when I change the file name, instead of updateiing the field manually every time? Is this possible? Also if possible can I do the same for a footer field? |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Insert source texts into multiple files and update automatically | Microsoft Word Help | |||
how do I change or add a new field in a data source? | Mailmerge | |||
change text colour and size in text form field | Microsoft Word Help | |||
I want to change a CD-Read only file to a CD-RW File so that I ca. | Microsoft Word Help | |||
Using time and date change to recover file | Microsoft Word Help |