Field codes: FileName field

The FileName field inserts the file name of the document, as recorded on the General tab in the Properties dialog box. To view the Properties dialog box, click the File tab,click Info, click Properties (below the document preview on the right side), and then click Advanced Properties.

Security  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:

{ FILENAME [Switches] }

 Note   A field code tells the field what to show. Field results are what is shown in the document after having evaluated the field code. To toggle between viewing the field code and the field code results, press Alt+F9.

Switches

\p

Includes the file location, or path (path: The route that the operating system uses to locate a folder or file; for example, C:\House finances\March.doc.), 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 (header and footer: A header, which can consist of text or graphics, appears at the top of every page in a section. A footer appears at the bottom of every page. Headers and footers often contain page numbers, chapter titles, dates, and author names.):

Document: { FILENAME \p }

 
 
Applies to:
Word 2013, Word 2010