Dynamic Path and Filename in a Footer

by Allen Wyatt
(last updated October 17, 2016)

4

Patricia wrote about a problem she was having with placing a dynamic path and filename in the footer of her documents. Actually, the problem was related to putting the path and filename in the footer of a template, and then having it update properly. It seems that whenever a new document is created based on the template, the path and filename reflects the template, not the document—even after saving the document.

This is actually normal behavior for Word. When you use AutoText to insert the path and filename, what it does is insert a field code. Specifically, it inserts the { FILENAME \p } field. (The \p parameter means that the path is included with the filename.) Like any other field, there are only specific times that the field result is updated. It is updated when it is first used (as in when you insert the field), and subsequently it is updated only when you print the document or when you explicitly update it.

This means that the { FILENAME \p } field will always reflect the last time it was updated, until you do something to update it again. Thus, it reflects the name of the template until you update the field. There is more information on this behavior in the following Knowledge Base article:

http://support.microsoft.com/kb/832897

If you don't want to print your document to update the field, you can view the field using Print Preview; this also updates the field. You could also select the field and press F9 to update it, but doing so would be quite tedious. Another solution is to create a macro that updates the fields. The Knowledge Base article listed above includes several macros you can use. Most of them follow this pattern:

Sub AutoOpen()
    Selection.WholeStory
    Selection.Fields.Update
End Sub

This macro—which is just an example—updates the fields in the body of a document every time you open it. (More full-featured macros are described in the Knowledge Base article referenced earlier.) You could also use variations of this macro to update fields whenever you save the file, as well.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (3824) applies to Microsoft Word 97, 2000, 2002, and 2003.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Creating and Naming a Worksheet Using a Macro

You can use macros to make your common Excel tasks easier and faster. For instance, if you routinely need to create new ...

Discover More

Error when Double-Clicking Workbook Files

When you double-click an Excel workbook on your system, Windows has to do a lot of behind-the-scenes work to start Excel and ...

Discover More

Scroll Wheel Doesn't Work when Editing

Using the mouse's scroll wheel can help improve how you edit information in a worksheet. Here's how to make sure that the ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (menu)

An Automatic File Name

Do you have a set "standard" for how you name new documents? If so, you may be interested in implementing the technique in ...

Discover More

Making Backup Copies

When you save your documents, Word doesn't normally make backups of your files. If you want the program to do that, it takes ...

Discover More

Opening a Document as Read-Only

Afraid of messing up an existing document by some changes you are considering? Consider opening the document as read-only, so ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two more than 4?

2016-06-02 07:46:00

wanda

The issue I am having is that when I send a document that I created at home to my work address to print it, the path/file name updates to my work path which I don't want. I want to retain the path/file name that I gave it when I was working on it at home. Solution? Thanks!


2016-02-08 11:38:03

Robin Roads

Like Patty below I want to do a footer with filename in it. I could do it in Office 2011 for MAC, now with 2016 I can't do it and I can't find any help online. In despair!


2015-08-17 04:16:43

Juliet

Hi
Very very thanks.
Tested in MS Word 2010 & 2013


2014-02-12 17:24:23

Patty

This does not seem to work with Word 2010
I would like to do a footer with the filename and path in it.


This Site

Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.