Shortcuts for getting the filename and path into your document

On my post about how to add the file name and path to a header or footer, Steven asks a good question:

"Is there a way to save this into a shortcut for future use?"

I've found a few ways to do this:

  • You can save the field code in your Header gallery or your Footer gallery.
  • You can save the field code as AutoText.
  • You can create a macro that will insert the correct field, and you can add a button that runs the macro on the Quick Access Toolbar.

In each case, it will look like you're saving your document's name as a shortcut, but really you're saving the field code. When you press ALT+F9, the field code looks like this.

File name field code

Note: This is a really long post--so if you know you want the button, skip ahead to the section on creating a macro.

Option 1: The Header or Footer gallery

After you insert the FileName field into your header or footer, select the field (it will say the name of your document), but don't select the paragraph mark.

Click Header or Footer, and then click Save Selection to Header Gallery or Save Selection to Footer Gallery.

Add the FileName field to the gallery

The upside? It's easy to do. The downside? You need to scroll to the bottom to find your new gallery entry.

Option 2: The Filename field as AutoText

This begins the same way: After you insert the FileName field into your header or footer, select the field (it will say the name of your document), but don't select the paragraph mark.

On the Insert tab, in the Text group, click Quick Parts, and then click Save Selection to Quick Part Gallery.

Add the FileName field to Quick Parts

In the dialog box that opens, type a name that you'll remember, and then in the Gallery list, click AutoText. (You can choose any gallery, but AutoText seems to be a shorter shortcut.)

Adding the FileName field to AutoText

The upside? It's also easy to do. The downside? You still need to click Quick Parts and point to AutoText and find your gallery entry--which isn't that much faster than inserting the field.

Option 3: Create a macro

You can use this procedure to create other shortcut buttons, too.

Double-click in the header area or the footer area.*

On the View tab, in the Macros group, click Macros and then click Record Macro.

Record a macro to add the FileName field

Type a name (without any spaces) and then click the Button button.

The button option for macros

In the Word Options dialog box, click the name of your macro, and then click Add to add it to the Quick Access Toolbar.

If you want to change how the button looks, click Modify and choose a new button.

Click OK.

Now, insert the FileName field.

Then click the View tab again, click Macros, and click Stop Recording.

When you click the new button on the Quick Access Toolbar, Word will insert the FileName field.

Enjoy your shortcuts!

-- Joannie Stangeland

* If the double-click action isn't working for you, you can click Insert, click Header or Footer, and then click Edit Header or Edit Footer.

Office Blogs Comments

Comments: (28) Collapse

  • Recently, you sent a message about updating my office program. Now my files are on-line. I want my files back on my computer. I am really angry. I don't want my files on your server. GIVE THEM BACK NOW, please. I am extremely upset. I don't want to wait for my files to down load, I don't always have the internet on to work and the way you have it, I can't get to my files without it. I don't want you storing my files, where I am creating things I may choose to publish, in someplace I can't reach them when I want them. Furthermore, It is an invasion of my privacy. At the time it was first offered, I told your progam, no. Then after I saw what you wanted and rejected it, you sent me a message anyway that did not explain what you were doing. That, in my opinion, is dishonest. I paid alot for your program because you are good, but I am extremely dissatisfied at this time.

    Sincerely,

    Sally Kirkpatrick

  • The save to header/footer gallery is a sweet trick. To make it quicker, we can add the gallery to the QAT so that there is no need to switch tabs while working.

  • Dear Sally,

    That sounds frustrating. Without knowing more specifics, I can't provide exact instructions. However, a good place to ask questions and get answers is Microsoft Answers (http://answers.microsoft.com). You can search for information about the server where your files are online. I guessed that maybe they're on SkyDrive, so here is a link to answers about SkyDrive: social.answers.microsoft.com/.../en-US.

    I hope this helps.

    -- Joannie

  • It has taken me over half an hour to set up a footer in 2010 with filename and page x of y, one that took me less than 10 seconds in 2003.  I never would have been able to do this without your blog.  I tried to save my footer in Quick Parts but it will only save one component.  There must be an easier way.  Why did MS take some things that were so easy and make them so stupidly difficult?

  • Reba,

    To get both parts of the header saved into Quick Parts, select the whole line (except for the paragraph mark at the end). Then, click Quick Parts and click Save Selection to Quick Part Gallery.

    I hope this helps!

    -- Joannie

  • Joannie,

    Thank you for these instructions. I happen to have similar experiences as that described by Reba in terms of some things seeming to be more complicated than previously.

    But your two posts on adding File Name and Path and on shortcuts -- especially the video or visual demonstration -- were extremely helpful. Thank you.

  • I agree with the comment:  It has taken me over half an hour to set up a footer in 2010 with filename and page x of y, one that took me less than 10 seconds in 2003.  I never would have been able to do this without your blog.  I tried to save my footer in Quick Parts but it will only save one component.  There must be an easier way.  Why did MS take some things that were so easy and make them so stupidly difficult?

    this is one of the biggest step backward ms has taken

  • On Option 1.. when saving to the gallery, you can enter the name with a "~" in the first position (ex: ~ Footer Name) and it will sort the entry up top right below Blank.

  • Sally, your comment on creating the macro for file name was great.  On an older version of Word I used a macro that opened the footer and using the field name, etc. and went through the whole procedure of adding the file name in the footer.  

    In the 2010 version the macro will not record the inserting he footer and completing the procedure.  When I use the quick access ribbon, it places the file name and path in the document itself and not in the footer.

    I hope this makes sense.

    Thanks,

    Roger

  • I totally agree.  Putting your file path into the footer was very easy in 2003.  Why in the world did MSFT take this simple procedure away?  I spent hours trying to figure out how to do this and didn't go through your blog because that seems like a huge waste of time and from comments of others it appears it doesn't work that well either.  I do hope the folks at MSFT read this and fix this big flaw in their 2010 version.  Actually, I regret upgrading and I tell everyone I see not to do it!

  • I don't understand why it is so hard to insert a filename and/or path into a document.  I am a heavy Word and Excel user and I keep wondering what word processor and spreadsheet programs the folks at Microsoft use.  If they used Word and Excel as much as I do there is no way it would operate the way it does.  I wonder if they use WordPerfect when they have to write a report? Plus as several people commented some things were MUCH easier to do in previous versions.  If the people at Microsoft actually used Word and Excel, they wouldn't take out the "good stuff" when they make a new version.  Maybe Microsoft should REQUIRE its programmers and mangers to actually use the software.

  • There's a field in the previous versions allowing you insert an automatic update of your file location should be file be moved.  Where is it hidden in this version?

  • Dear Edwin --

    This FileName field (with the Path check box selected) is the one! You can find more information about inserting the field here: blogs.office.com/.../add-the-filename-to-your-header-or-footer.aspx. Then, set your options in the Options dialog box (File tab, Options, Display) so that your fields update before you print (it doesn't update automatically unless you print). To manually update, click the field (or press CTRL+A to select the entire document) and press F9.

    -- Joannie

  • The procedure to enter a header or footnote is not only not an improvement in 2010 but I could not find any explanation on a recently purchased "plain simple" nor on downloaded office 2010 information from Microsoft website. It use to be so easy  to enter a path reference and now you cannot even find a "path" referenced in the index. Somebody blew a gasket in Gates land.

  • Mario --

    I'm sorry for your frustration. While we don't yet have PATH in the Word 2010 table of contents, we cover it here: blogs.office.com/.../add-the-filename-to-your-header-or-footer.aspx. And we cover adding the file location here: blogs.office.com/.../add-the-file-location-in-word-video.aspx.

    -- Joannie

1 2  Next >
Comments

Comments: (loading) Collapse