Adding file path and name to footer

  • Thread starter Thread starter Ray W
  • Start date Start date
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?
 
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

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Back
Top