Written by Allen Wyatt (last updated March 4, 2023)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021
Jack wants to create a Normal template that has a footer with the filename and file path in it. He's doing this by adding fields to the footer. Jack can't seem to get the path in it, even after ticking the appropriate box when inserting the field. It seems, to Jack, that the user has to manually enter the fields into the footer of a new document.
It appears, from his description, that Jack knows how to insert the field codes into the footer of his template. So, rather than provide the steps to do so here, I'll just point out that the actual field code should end up looking very similar to this:
{ FILENAME \p \* MERGEFORMAT }
The field switch (or, if you prefer, the field option) that causes the path to be included with the filename is the \p switch.
If your field code looks like this or very similar to this, then the next step is to look at how Word treats fields. This is very important because the fields, in Jack's case, are part of a template. When you create a new document based on that template, the document has obviously not been saved yet—it is brand new. So, there is no filename or path for the field code to return. So, you go and save this new document, and you now have a filename and path, so you would think that the field code in the footer would update to reflect that information.
But it doesn't. Why not? Because Word doesn't update fields automatically. There is only one time that you can count on for them to be updated automatically, and that is when you choose to print the document. Do that, and the filename and path in the footer should update. Or, if you prefer, just use the Print Preview capabilities of Word to trick Word into thinking you are printing, and the information should be updated.
Of course, you can "force" Word to update the information in the footer. There are two ways you can do this. One is to go into the footer and place the field code anew. This is what it seems that Jack is talking about, and doing so forces Word to grab information (the filename and path) and display it in place of the newly inserted field code. The other way you can do it is to go into the footer, select the field code, and press F9 to force Word to update what is displayed. Of course, both of these methods to force the update need to be done after the new document is initially saved—it is only at that point that a filename and path are available.
There are ways around this situation, and rather than repeat them here, I'll direct readers to the following tip which provides a large number of approaches:
https://wordribbon.tips.net/T013475
There is one caveat to remember when it comes to the pathname returned by the field code: if the document is stored on OneDrive the path is shown as a URL rather than a path to the synced file on your local drive. So, if you are using OneDrive you might not get the results you want from the field code.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13044) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021.
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!
If you are creating a macro that, in the course of processing your document, needs to update all the fields in the ...
Discover MoreWhen you attach a template to a document, it doesn't modify the documents headers or footers. This tip provides three ...
Discover MoreYou may have some standard headers and footers you want to make available in your document templates. This tip describes ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2023-03-07 22:39:55
Tomek
What is even more complicated is that the template Normal.dotm saved in Custom Office Templates cannot be accessed from the Backstage.
Even worse, if you click on Normal.dotm template in Custom Office Templates in File explorer, the document created will be still based on the Normal template from C:\Users\<user>\AppData\Roaming\Microsoft\Templates\, not on the one you clicked. Go figure.
It seems that the only way to see what is in the Normal.dotm from custom Office Templates is to open it from within Word, which will open the template, not create a new document.
2023-03-07 22:10:42
I just realized one possible reason for Larry's problem. If you create a document with all things needed in your template and <b>***save it as*** </b> <Normal.dotm, it will likely end up in your Custom Office Templates, and the template used for new documents is likely in location shown in step 3.
So much for Microsoft Logic.
2023-03-07 21:51:24
@Larry Schwartz:
I am not sure if this will help you, but here are my suggestions (I had similar problem once):
I found that there may be more that one Normal template on a particular system. This implies both templates with different extensions (.dot, .dotm, .dotx) as well as the Normal templates located in different folders on your drive(s). Word has its own preference order for which template it will use when creating a new document.
1. To check for what templates exist on your system, first go to Word Options - Trust Center -Trusted Locations.
2. Navigate to each of these locations and check if it contains any Normal.dot? file. If so, open this file from within Word to make sure that you are editing the template not a new document based on it. (not by double-clicking on it)
3. In the body of text in each template you open type in some identifying text like "Normal in C:\Users\<user>\AppData\Roaming\Microsoft\Templates\"
4. Save the template back to the same location, and close it. Do not use save as option. Pay attention to where the template is saved - if in doubt check the date time stamp on the file.
5. Repeat steps 2-4 for all remaining locations and templates found.
6. Create a new document. You should be able to see your identifying text. if so, you can figure out which template is actually used.
7. Open that identified Normal template again as in step 2. Delete your identifying text, and add the filename field wherever you want it to be. Save the template back to the same location. Same warnings as in step 4 apply.
8. Get rid of all the other Normal templates you found to avoid future confusion, or at least rename them.
Let me know if it worked for you.
2023-03-05 18:08:01
Referring to WordTips (ribbon) for 25 February 2023, I've been unable to put the filename field into the Normal template. I've wanted to do this for a long time. You gave a solution to Jack Oster's request at
https://wordribbon.tips.net/T013044_Putting_a_File_Name_and_Path_in_a_Default_Footer.html, but it doesn't work for me. I went to my C:\Users\Owner\AppData\Roaming\Microsoft\Templates where I found Normal.dotm (11/28/2022)
and Normal.dotx dated today from my failing efforts.
Because notes on the web about the filenamne in footer refer to Normal.Dotm I opened it and inserted Header & Foooter > Quick Parts > Field > Filename in the footer. Word has assigned the name Document 1 to the file as noted in the title field in the top of the Word window but I saved it as Normal.Dotm. I closed the file and opened a new document. The footer was empty. I opened Normal.Dotm and the field was there.
To my understanding, DOTM is for macro-enabled files, and DOTX is for templates; however, I found no DOTX files on my Windows 11 / Office Home and Student 2021 / Word Version 2302 (Build 16130.202118 Click to Run) that came with my HP purchased new late last year.
I then saved my Normal.Dotm as Normal.Dotx. I closed the file and opened a new one that Word named Document 3. The footer field was not there.
Your help will be very appreciated!
Thanks,
Larry Schwartz
2023-03-04 18:49:11
Tomek
Here is the promised Macro. The name of my printer on NUL: port is "NulPrint"; adjust the macro, if you named yours differently.
You can assign this macro to a QAT button.
Sub Print2Nul()
CurPrinter = ActivePrinter
ActivePrinter = "NulPrint"
Application.PrintOut
ActivePrinter = CurPrinter
End Sub
2023-03-04 09:15:16
Tomek
Re: Or, if you prefer, just use the Print Preview capabilities of Word to trick Word into thinking you are printing, and the information should be updated.
This functionality stopped working a few years ago, so you actually need to print the document. Not to waste paper, you can print to a pdf file, or better, print to a NUL printer.
You can find the information on how to install additional printers following the link
https://www.howtogeek.com/362957/how-to-install-the-same-printer-twice-with-different-settings-on-windows/
It does not matter what printer you install, as long as you select nul: as the port to print to. As nothing is really printed, the printing to NUL: port is really fast.
Once you installed a printer that way, you can use a macro to print to the NUL printer, then restore the default printer. I'll post the macro separately.
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments