Can the file name automatically be placed as a trailer in doc?

G

Guest

I am new to Word, having been a staunch WordPerfect addict. Now our firm has
been forced to use Word and I have finally relented. One of the attorneys
has asked how to put a "trailer" on the document which identifies it with the
file name. He thinks there is an automatic way of doing it without typing
the file name in a footer.

Is there a way?
 
S

Suzanne S. Barnhill

You can insert a FILENAME field anywhere in a document, not just the footer,
but keeping it at the *end* of the document may require special steps.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
G

Graham Mayor

You could use a macro to place the filename and path in the footer of the
last page e.g. in the following example the macro will save the document if
it is not already saved and add the filename and path, right aligned, in the
footer of the last page of the last section.
If you add to the length of the document after running the macro you will
need to update the fields, to ensure that the filename moves to the last
page again, for which purpose you could use the macro in the following link.
http://www.gmayor.com/installing_macro.htm

which also explains how to install the macros.
If the document already has a footer then this macro may affect the layout
of that footer.

Sub FilenameinLastPageFooter()
With ActiveDocument
If Not .Saved Then
.Save
End If
End With
Selection.EndKey Unit:=wdStory
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
With Selection
.ParagraphFormat.Alignment = wdAlignParagraphRight
.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
.TypeText Text:="IF"
.Fields.Add Range:=Selection.Range, Type:=wdFieldPage, _
PreserveFormatting:=False
.TypeText " = "
.Fields.Add Range:=Selection.Range, Type:=wdFieldNumPages, _
PreserveFormatting:=False
.TypeText " "
.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
.TypeText Text:="Filename \p"
.EndKey Unit:=wdStory
.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
.Fields.Update
End With
With ActiveWindow.ActivePane.View
.ShowFieldCodes = False
.SeekView = wdSeekMainDocument
End With
End Sub

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Suzanne S. Barnhill

OTOH, you can equally well put this field in the footer of the document
template:

{ IF { PAGE } = { NUMPAGES } { FILENAME \p } }

This will insert the filename and path in the footer of every new document
based on the template on the last page only, assuming that pagination is
continuous.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
G

Graham Mayor

This is essentially what the macro does, though aimed more at idiot
attorneys for whom opening the footer appears too hard to do ;)

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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