Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

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.

Syntax

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

{ FILE NAME [Switches] }

Switches

\p

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

Example

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?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×