The FileName field inserts the file name of the document, as recorded on the General tab in the Properties dialog box.

To view Propertiesfor a document, on Windows, choose the Filetab, choose Info, choose Properties, and then choose Advanced Properties. On Mac, choose the Filemenu, and then choose Properties.

A field codetells Word what to insert or provide to the document after determining the value of the field code, such as the current date or the number of pages. Usually, the resulting value is simply displayed as part of the document. You can toggle between viewing the result or viewing the field code by pressing Alt+F9 on Windows or fn+Option+F9 on Mac.

Security Note: Because field codes can be visible to anyone reading your document, be sure that the information you place in field codes is not information that you want kept private.


When you view the FileName field code in your document, the syntax looks like this:

{ FILE NAME [Switches] }



Includes the file location, or path, with the file name.


To print information such as "Document: C:\MSOFFICE\WINWORD\REPORTS\Sales for QTR4.doc" on each page of a document, insert the following text and field in a header or footer:

Document: { FILENAME \p }

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Office Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!