How to Automatically Display the Saved Word File Name in a Header
Question details
The user wants the header of a locked Word template to automatically update and display the new file name when the document is saved under a different name.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Saving a locked template with a new name and needing the header to reflect the updated file name or client name without manual edits.
- Observed behavior
- The header retains the original text and does not automatically copy the saved file name into the header text without using a specific field or macro.
Ensure you have the necessary permissions or password to temporarily unlock the Word template, as you must insert dynamic fields into the header before restricting editing for end users.
Insert a FileName Field into the Header
Use Word's built-in FileName field to dynamically pull the current saved file name into the document's header.
The FileName field automatically detects the name under which the document is saved. This is the most direct way to display the file name, though it will typically include the file extension (like .docx).
Temporarily remove the editing restrictions on your template so you can modify the header.
Double-click the top margin of your document to access the Header section.
Go to the Insert tab on the ribbon, click on Quick Parts, and then select Field from the dropdown menu.
In the Field dialog box, scroll through the Field names list and select 'FileName', then click OK.
Save the template under a new name. To see the updated name, you may need to force a refresh by switching to Print Preview or selecting the field and pressing F9.

Use a Document Property for Cleaner Client Names
If you want to display only the client's name without the file extension, inserting a Document Property is a better alternative for locked templates.
Easily Manage Headers and Dynamic Fields with WPS Office
WPS Writer offers an intuitive and highly compatible interface for inserting dynamic fields, document properties, and managing headers in your professional templates.
- 1. Open your template in WPS Writer: Launch WPS Office and open the document or template you wish to edit.
- 2. Access the Header: Double-click the header area at the top of the page to enter editing mode.
- 3. Insert the dynamic field: Navigate to the Insert tab, click on 'Fields', select 'Document Information', and choose 'File Name'.
- 4. Save and refresh: Save the document with a new name. Select the inserted field and press F9 to update it instantly.

Frequently Asked Questions
Why doesn't the FileName field update immediately after saving?
Word requires fields to be refreshed to display new data. You can manually update the field by selecting it and pressing F9, or you can force an update by switching to Print Preview.
Can I hide the .docx extension when using the FileName field?
The standard FileName field displays the full saved name, including the extension. If you want to display just a clean client name, it is recommended to use Document Properties (like Title) instead of the FileName field.
How do end users update the header if the template is locked?
If you map a Document Property (such as Subject or Title) in the header, users can update the text by going to File > Info and editing the property details. This changes the header text without requiring a password to unlock the document.




