update document name field on saving

B

bilisa

Hi all

I want my document name field inside my document to be updated when I use
save or save as. Is it possible with VBA? Any help is appreciated. :)
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?YmlsaXNh?=,
I want my document name field inside my document to be updated when I use
save or save as. Is it possible with VBA?
Could you please be more specific by what you mean with "document name
field"? Have you inserted a FILENAME field? In what part of the document
(main text, header, footer, other)? And which version of Word do you have?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
B

bilisa

Hi
A filename field in my document header. Im using version 2003 small Business
edition.
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?YmlsaXNh?=,
A filename field in my document header. Im using version 2003 small Business
edition.
The simplest way would be to have a macro named FileSaveAs (since updating the
name is really only relevant when saving the file to a new location or name). A
macro named the same as a toolbar command overrides the built-in behavior, so:

Sub FileSaveAs()
Dialogs(wdDialogFileSaveAs).Show
For each sec in ActiveDocument.Sections
sec.Headers(wdHeaderFooterPrimary).Range.Fields.Update
sec.Headers(wdHeaderFooterFirstPage).Range.Fields.Update
Next
End Sub

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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

Top