In enterprise document management, legal workflows, and quality assurance audit environments, documents are routinely created from standardized Microsoft Word templates (such as corporate letterheads, contract frameworks, or ISO procedure forms). Maintaining document traceability requires authors and auditors to verify which specific template version or network share path generated a given document. Rather than manually typing template filenames into document footers or relying on external metadata viewers, Microsoft Word automates template tracking using the native TEMPLATE field code.
How the TEMPLATE Field Code Operates
Every Microsoft Word document is attached to a template—either the global default Normal.dotm template or a specialized custom template file (such as Corporate-Proposal-2026.dotx). The TEMPLATE field queries the internal document header properties to output the name or file path of this attached template.
The standard syntax for the field is:
{ TEMPLATE [Switches] }
When evaluated without switches, the field outputs the simple filename of the attached template (for example, Corporate-Proposal-2026.dotx). When documents are re-attached to updated templates or migrated to new repository versions, refreshing the field automatically synchronizes the displayed name.
TEMPLATE Field Switches and Path Formatting
The TEMPLATE field supports the path switch (\p) to control whether directory structures are revealed:
| Switch | Output Format | Example Construction |
|---|---|---|
\p |
Displays the full drive and directory path to the attached template file. | { TEMPLATE \p } |
| (None) | Displays only the template filename and file extension without directory paths. | { TEMPLATE } |
For example, if a document was created from a network template located on a shared corporate server:
{ TEMPLATE }renders as:Legal-Master-Agreement.dotx{ TEMPLATE \p }renders as:\\server01\templates\legal\Legal-Master-Agreement.dotx
Inserting the TEMPLATE Field Manually
To insert an auto-updating template reference into a document footer or revision control block:
- Place your cursor where the template reference should appear (for example, in the document footer:
Base Template:). - Press Ctrl + F9 (or Command + F9 on macOS) to generate field brackets:
{ }. - Inside the brackets, type
TEMPLATE:{ TEMPLATE } - If you require the full folder path, append the
\pswitch:{ TEMPLATE \p } - Press F9 to evaluate and collapse the field code.
Word collapses the brackets and immediately displays the name of the template attached to your active document session.
Attaching or Changing the Document Template
If your document was started from a blank canvas (attached to Normal.dotm) and you need to link it to an official corporate template:
- Navigate to the Developer tab on the Ribbon. (If the Developer tab is hidden, right-click any Ribbon tab, choose Customise the Ribbon, and check the Developer box).
- In the Templates group, click Document Template.
- In the Templates and Add-ins dialogue box, look at the Document template field.
- Click Attach, browse to select your desired
.dotxor.dotmtemplate file, and click Open. - Check the box labelled Automatically update document styles if you want the styles from the new template to overwrite existing formatting.
- Click OK.
Once re-attached, select your TEMPLATE field in the document and press F9. The field immediately updates to display the newly linked template name or network path.
Updating and Refreshing Field Codes
Like all document property fields in Microsoft Word, TEMPLATE fields remain static until recalculated:
- Update All Fields: Press Ctrl + A to select the entire document, then press F9.
- Toggle Field View: Press Alt + F9 (or Option + F9 on macOS) to toggle between the raw code
{ TEMPLATE \p }and the rendered file path. - Export Assurance: To ensure that exported PDF files or printed printouts always display the accurate template path, enable File > Options > Display > Update fields before printing.
Auditing Template Paths During Document Distribution
When distributing contracts or confidential files to external clients, displaying full internal network paths (e.g., \\internal-shares\hr\templates\) via { TEMPLATE \p } may reveal internal server names and directory structures. Before public distribution, either remove the \p switch to display only the filename or unlink the field by selecting it and pressing Ctrl + Shift + F9 to convert the field into plain static text.