filename and path to automatically appear on all word documents

M

mhy

What I am looking to do is when I create a new word document, I want the
filename and path to automatically appear in the footer of the document
without ever having to think about it. I would like it to just happen and
appear when I print the document. Can I set this up once in word and have it
happen on every document I create or on an old document that I re-open.
Thanks.
 
G

Graham Mayor

The short answer to your question is 'No'.
New documents do not have a filename, until they are saved and filename
fields if present in the template would not automatically update.
Which footer? A document can have more than one.
Adding a filename field to the normal template will intefere with some
operations - eg the creation of labels - and is strongly discouraged.
If you added the filename field to every document that you open
'automatically' then unless you know where the field is located (which you
may not readily) then the macro required will add the field to any field
that may already be present.
An answer to both is to remove the 'automatic' requirement and add the
filename information manually as needed using a macro fired from a toolbar
button. The following will type the filename and path in the footer
associated with the page the cursor is in.

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

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

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