template in footers

S

Sabrina

I need the filename to appear as a footer on each document that is created.
Can this be done in template? I need it to be automatic.
 
G

Graham Mayor

It all depends on your definition of 'automatic'.

When you create a document it doesn't have a name until you first save it.
Filename fields can be inserted in the document footer, but they don't
'automatically' update unless you provide the conditions for them to do so -
eg by switching to print preview.

You can add a filename field to a template (not please to the normal
template) and create documents from that template, albeit with the proviso
just mentioned, or you can use a macro to save the document and add the
chosen filename to the footer e.g.

Sub InsertFilenameinFooter()
With ActiveDocument
If Len(.Path) = 0 Then
.Save
End If
End With
Selection.EndKey Unit:=wdStory
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
With Selection
.ParagraphFormat.Alignment = wdAlignParagraphRight
.TypeText ActiveDocument.FullName
End With
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub

Replace .FullName with .Name if you don't want the path included.

http://www.gmayor.com/installing_macro.htm


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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Top