File Names

C

Colin Doyle

Once I have saved a document and allocated a file name,
how do I automatically insert the file name into the
document so that I can easily trace it at a later stage

Thanks
 
G

Greg Maxey

Colin,

There is a Word Field Code {FileName} for doing this. You can also use one
of the AUTOTEXT entries. Insert>AutoText>Headers and Footer>File Name or
File Name and Path.
 
E

emce10282

Do know of anyway to set up the filename/p field to update itself automaticaly when you save the document in another location?
 
G

Greg Maxey

emce10282,

I am not a VBA expert by any means, but I have cobbled together the
following from code developed by other people, This macor replaces the
normal SAVEAS command and does two things

1) Puts the Filename on the title bar
2) Updates document fields after the save.

Sub FileSaveAs()

SendKeys "+{TAB}"
Dialogs(wdDialogFileSaveAs).Show
System.Cursor = wdCursorNormal
ActiveWindow.Caption = ActiveDocument.FullName
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
 

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