Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
MK MK is offline
external usenet poster
 
Posts: 15
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom Stefan Blom is offline
external usenet poster
 
Posts: 8,428
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert source texts into multiple files and update automatically robfer Microsoft Word Help 9 September 12th 07 10:10 PM
how do I change or add a new field in a data source? Toody Mailmerge 2 April 8th 06 05:48 PM
change text colour and size in text form field Dana Microsoft Word Help 0 April 7th 06 10:29 PM
I want to change a CD-Read only file to a CD-RW File so that I ca. non-plused Microsoft Word Help 3 July 21st 05 01:42 PM
Using time and date change to recover file Max63 Microsoft Word Help 1 May 30th 05 09:03 PM


All times are GMT +1. The time now is 09:06 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"