Document Editing Problems

How to Automatically Insert a File Name into a Word Document

Olivia MillerOlivia Miller Nov 4, 2026 873 views

Question details

The user wants to insert the current document's file name into the body text and ensure it updates automatically if the file is renamed or moved.

How to Automatically Insert a File Name into a Word Document
Product
Microsoft Word
Device & OS
not provided
Scenario
Adding dynamic document identifiers, such as the file name or file path, directly into the text for better document tracking.
Observed behavior
The user needs the displayed text to dynamically reflect the actual saved file name and path rather than manually typing it out.
Before you start

Ensure your document has been saved at least once so that the application has an actual file name and location to reference in the field.

Solution 1Recommended

Use the FileName Field to Insert the Document Name

Using the built-in Field feature allows you to display the current file name in your document and easily update it if the file is renamed.

Microsoft Word handles dynamic text through a feature called 'Fields'. By inserting a FileName field, the document references its own saved name. However, keep in mind that Word fields do not constantly refresh in real-time; they require a manual trigger or specific print settings to update after a change is made.

1
Position your cursor

Click exactly where you want the file name to appear in the body, header, or footer of your document.

2
Access the Field options

Navigate to the 'Insert' tab on the top ribbon. In the 'Text' group, click on 'Quick Parts' and select 'Field' from the drop-down menu.

3
Select the FileName field

In the Field dialog box, locate the 'Field names' list, scroll down, and select 'FileName'. You can customize the text format (e.g., Uppercase, Lowercase) in the Field properties.

4
Insert into the document

Click 'OK'. The current file name will now appear in your document. To include the full folder location, check 'Add path to filename' before clicking OK.

Use the FileName Field to Insert the Document Name
Updating the Field Manually: If you rename the file later, the inserted name won't change instantly. Select the file name text (or press Ctrl+A to select the whole document) and press F9 to update all fields with the new file name.
Efficient Document Editing

Easily Insert File Names with WPS Writer

WPS Writer offers a highly intuitive interface for inserting dynamic document fields, including file names and file paths. It is fully compatible with Microsoft Word formats, making your document management seamless and efficient.

  1. 1. Open your document: Launch WPS Writer and open the document you wish to edit. Place your cursor where the file name should go.
  2. 2. Navigate to the Insert tab: Click on the 'Insert' tab located on the top ribbon, then click the 'Field' button.
  3. 3. Choose Document Information: In the Field dialog box, select 'Document Information' from the Categories list, then choose 'FileName'.
  4. 4. Insert and Update: Click 'OK' to insert the file name. Whenever you rename the document in the future, simply select the field and press F9 to refresh it.
Quickly insert dynamic fields like FileName, Date, Time, and Author.Fully compatible with Microsoft Word (.docx) documents.Lightweight, fast, and free alternative for efficient document editing.
microsoft office alternative - wps office

Frequently Asked Questions

Can I include the full file path along with the file name?

Yes. When you are in the Field dialog box selecting the 'FileName' field, look for the field options on the right side and check the box that says 'Add path to filename'. This will display the complete folder location along with the file name.

Why didn't the file name update after I renamed the document?

Word processors do not automatically continuously monitor and update fields while you type. After renaming or moving a file, you must force an update. Select the field (or press Ctrl+A to select the entire document) and press the F9 key on your keyboard to refresh the data.

Is there a way to make fields update automatically before I print?

Yes. You can instruct the software to update all fields automatically before printing. Go to File > Options > Display, and under 'Printing options', check the box for 'Update fields before printing'. This ensures your printed copy always has the latest file name.