Adding file path and name to footer

R

Ray W

I am building a template that I would like that file path and name to appear
automatically in the footer (like Excel). Is this possible in Word 2003?
 
G

Graham Mayor

It depends on your definition of 'automatically'. You could put a { filename
\p } field in the footer, but the document will not have a name and path
until the document is saved, and when you save it the field will only update
if you force an update. You can use the macro at
http://www.gmayor.com/installing_macro.htm to update the field.

Or you can simply insert the filename and path into the document using a
macro e.g.

Sub InsertFileNameAndPath()
Dim fFname As String
With ActiveDocument
If Len(.Path) = 0 Then
.Save
End If
fFname = .FullName
End With
Selection.TypeText fFname
End Sub

or into the footer

Sub InsertFileNameAndPath()
Dim fFname As String
With ActiveDocument
If Len(.Path) = 0 Then
.Save
End If
fFname = .FullName
End With
Selection.EndKey Unit:=wdStory
ActiveWindow.ActivePane.View.SeekView = _
wdSeekCurrentPageFooter
Selection.TypeText fFname
ActiveWindow.ActivePane.View.SeekView = _
wdSeekMainDocument
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
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