Dynamic Path and Filename in a Footer

Written by Allen Wyatt (last updated October 26, 2019)
This tip applies to Word 97, 2000, 2002, and 2003


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 reflect 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/?kbid=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.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

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

Scrolling Text Sideways

Most people use the mouse wheel to scroll their document up and down. What if it starts scrolling left and right, ...

Discover More

Making Changes in a Group of Workbooks

If you need to change the same data in a large number of workbooks, the task can be daunting. Here are some ideas (and ...

Discover More

Counting Times within a Range

Excel allows you to easily store dates and times in your worksheets. If you have a range of cells that contain times and ...

Discover More

The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!

More WordTips (menu)

Using a Standard Format in a Suggested File Name

Many companies (and some individuals) use specific formats for naming their documents. If you want Word to recognize your ...

Discover More

Can't Use AutoRecover with a Document

Having trouble getting Word to save your AutoRecover documents? Don't turn the feature off; try the techniques described ...

Discover More

Working with Other People's Files

When you get files from other people, you may want a quick way to apply your formatting to their text. Provided that the ...

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}] (all 7 characters, in the sequence shown) 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 8 - 5?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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.

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