Updating Fields in Word – How it Works
Word supports many different types of fields. A field is a set of codes that instructs Word to automatically insert material into a document. Some of the commonly used fields are PAGE fields that show page numbers and TOC fields that display a table of contents.
In order for fields to show the correct result, they must be updated. Some types of fields are updated automatically by Word whereas other fields must be updated by the user.
In this article, you will find information about how each kind of Word field works in relation to updating. Find out which fields are updated automatically by Word and which fields you must update manually. For each field, you will also find field names and numbers that can be used in VBA if you need to create or edit fields via macros.
Fields in headers and footers of documents
Note that Word treats fields in the header or footer of a document differently from fields in the main body of document in relation to updating. Fields in headers and footers are updated more automatically by Word than fields elsewhere in the document.
Most fields in headers and footers update automatically when you open a document
Most fields in the header and footer are updated automatically when you open a document.
However, FILENAME fields in the header or footer are not updated automatically when opening a document. According to information in the Microsoft article The FILENAME field does not automatically update when you open a document in Word, this special handling of FILENAME fields was introduced as a design change in Word 2002 to allow documents to open more quickly. It would indeed be an advantage to have FILENAME fields update automatically when opening a document - the speed would most likely not be a problem anymore. You need to update the fields. See How to update fields manually.
Fields in headers and footers are updated when you switch to Print Preview
When you switch to Print Preview, all fields in the header and footer are updated. This will also trigger FILLIN and ASK fields in the header or footer.
Fields in the main body of documents
The rules that apply to how fields update - cold, warm and hot fields
In the table below, all Word fields are listed and organized based on the way they are updated in the main body of documents.
I have used the terms cold, warm, and hot in this relation. Those terms are used in VBA and they can give an indication of how the individual fields work in relation to updating. In the table below, you will find a short description of the characteristics of each of these kinds of fields. For each kind, you will also find a list of all Word fields of that kind.
In the Color code column in the table below, I have assigned a color to each field kind. Those colors are also used in the list of all Word fields sorted alphabetically. The purpose is to make it easier to overview the lists.
In VBA, the wdFieldKind enumeration can be used to return the kind of field. See column 3 in the table below - it shows the wdFieldKind constants and the related numbers. For example, you can return the kind of the first field in the selection using the following VBA code:
Selection.Fields(1).Kind
The rightmost column lists all fields of each kind.
Kind |
Color code |
VBA – wdFieldKind |
Description – how fields are updated |
Fields grouped by kind |
Cold |
|
3 |
A field that doesn’t have a result. This also means that a cold field includes nothing to be updated. |
PRIVATE |
Warm |
|
2 |
A field that has a result and that can be updated. The group of warm fields include both fields that are automatically updated when the source changes and fields that can be manually updated. See also “Warm ++” below. See About updating fields for more details about manually updating fields. |
= (FORMULA) |
Warm ++ |
|
2 |
The term “Warm ++” is invented here for descriptive purposes. The description of Warm above applies but, in addition, these fields can be updated in one more way: Most of these fields are related to pagination and printing of documents. These fields can be updated by switching to Print Preview because this triggers repagination of the document. This is the case no matter whether the option File > Options > Display > Printing options group > Update fields before printing is ON or OFF. Printing a document or opening a document in Print Layout view will also cause these fields to update. |
DATE |
Hot |
|
1 |
A field that is automatically updated each time it is displayed or each time the page is reformatted. These fields can also be updated manually. See About updating fields for more details about manually updating fields. Note that you must save the document to retain the results of automatically updated fields. |
ADVANCE |
None |
|
0 |
An invalid field such as an empty field. If you create fields manually, you can start with an empty field. Examples of invalid fields: |
(Empty field) |
All Word fields sorted alphabetically - incl. VBA references
Below, you will find a list of all the different Word fields. For each field type, you will find the following information:
Field name |
Kind |
# |
VBA wdFieldType |
Comment |
|
Warm |
82 |
wdFieldSubscriber |
Subscriber field (I have not found any information about that field). |
|
|
91 |
wdFieldHTMLActiveX |
Not currently supported. |
(Empty field |
None |
-1 |
wdFieldEmpty |
Empty field. Acts as a placeholder for field content that has not yet been added. |
= (FORMULA) |
Warm |
34 |
wdFieldExpression |
|
ADDIN |
Warm |
81 |
wdFieldAddin |
Not available through the Field dialog box. Used to store data that is hidden from the user interface. |
ADDRESSBLOCK |
Warm |
93 |
wdFieldAddressBlock |
|
ADVANCE |
Hot |
84 |
wdFieldAdvance |
|
ASK |
Warm |
38 |
wdFieldAsk |
|
AUTHOR |
Warm |
17 |
wdFieldAuthor |
|
AUTONUM |
Hot |
54 |
wdFieldAutoNum |
|
AUTONUMLGL |
Hot |
53 |
wdFieldAutoNumLegal |
|
AUTONUMOUT |
Hot |
52 |
wdFieldAutoNumOutline |
|
AUTOTEXT |
Warm |
79 |
wdFieldAutoText |
|
AUTOTEXTLIST |
Warm |
89 |
wdFieldAutoTextList |
|
BARCODE |
Hot |
63 |
wdFieldBarCode |
|
BIBLIOGRAPHY |
Warm |
97 |
wdFieldBibliography |
|
BIDIOUTLINE |
Hot |
92 |
wdFieldBidiOutline |
|
CITATION |
Warm |
96 |
wdFieldCitation |
|
COMMENTS |
Warm |
19 |
wdFieldComments |
|
COMPARE |
Warm |
80 |
wdFieldCompare |
|
CONTROL |
Warm |
87 |
wdFieldOCX |
OCX field. Cannot be added through the Field dialog box but can be added via code by using the AddOLEControl method of the FormFields collection. |
CREATEDATE |
Warm |
21 |
wdFieldCreateDate |
|
DATA |
Warm |
40 |
wdFieldData |
|
DATABASE |
Warm |
78 |
wdFieldDatabase |
|
DATE |
Warm ++ |
31 |
wdFieldDate |
|
DDE |
Warm |
45 |
wdFieldDDE |
No longer available through the Field dialog box but supported for documents created in earlier versions of Word. |
DDEAUTO |
Warm |
46 |
wdFieldDDEAuto |
No longer available through the Field dialog box but supported for documents created in earlier versions of Word. |
DOCPROPERTY |
Warm |
85 |
wdFieldDocProperty |
|
DOCVARIABLE |
Warm |
64 |
wdFieldDocVariable |
|
EDITTIME |
Warm |
25 |
wdFieldEditTime |
|
EMBED |
Warm |
58 |
wdFieldEmbed |
|
EQ |
Hot |
49 |
wdFieldFormula |
|
FILENAME |
Warm |
29 |
wdFieldFileName |
|
FILESIZE |
Warm |
69 |
wdFieldFileSize |
|
FILLIN |
Warm |
39 |
wdFieldFillIn |
|
FORMCHECKBOX |
Hot |
71 |
wdFieldFormCheckBox |
Inserted via Developer tab > Controls group > Legacy Tools > Check Box Form Field button or via code. |
FORMDROPDOWN |
Hot |
83 |
wdFieldFormDropDown |
Inserted via Developer tab > Controls group > Legacy Tools > Drop-Down Form Field button or via code. |
FORMTEXT |
Warm |
70 |
wdFieldFormTextInput |
Inserted via Developer tab > Controls group > Legacy Tools > Text Form Field button or via code. |
FTNREF |
Warm ++ |
5 |
wdFieldFootnoteRef |
Not available through the Field dialog box. Inserted programmatically or interactively. |
GLOSSARY |
Warm |
47 |
wdFieldGlossary |
No longer supported in Word. |
GOTOBUTTON |
Hot |
50 |
wdFieldGoToButton |
|
GREETINGLINE |
Warm |
94 |
wdFieldGreetingLine |
|
HYPERLINK |
Warm |
88 |
wdFieldHyperlink |
|
IF |
Warm ++ |
7 |
wdFieldIf |
|
IMPORT |
Hot |
55 |
wdFieldImport |
Cannot be added through the Field dialog box but can be added interactively or via code. |
INCLUDE |
Warm |
36 |
wdFieldInclude |
Cannot be added through the Field dialog box but can be added interactively or via code. |
INCLUDEPICTURE |
Hot |
67 |
wdFieldIncludePicture |
|
INCLUDETEXT |
Warm |
68 |
wdFieldIncludeText |
|
INDEX |
Warm |
8 |
wdFieldIndex |
|
INFO |
Warm |
14 |
wdFieldInfo |
|
KEYWORDS |
Warm |
18 |
wdFieldKeyWord |
|
LASTSAVEDBY |
Warm |
20 |
wdFieldLastSavedBy |
|
LINK |
Warm |
56 |
wdFieldLink |
|
LISTNUM |
Hot |
90 |
wdFieldListNum |
|
MACROBUTTON |
Hot |
51 |
wdFieldMacroButton |
|
MERGEFIELD |
Warm |
59 |
wdFieldMergeField |
|
MERGEREC |
Warm |
44 |
wdFieldMergeRec |
|
MERGESEQ |
Warm |
75 |
wdFieldMergeSeq |
|
NEXT |
Warm |
41 |
wdFieldNext |
|
NEXTIF |
Warm |
42 |
wdFieldNextIf |
|
NOTEREF |
Warm ++ |
72 |
wdFieldNoteRef |
|
NUMCHARS |
Warm |
28 |
wdFieldNumChars |
|
NUMPAGES |
Warm ++ |
26 |
wdFieldNumPages |
|
NUMWORDS |
Warm |
27 |
wdFieldNumWords |
|
PAGE |
Warm ++ |
33 |
wdFieldPage |
|
PAGEREF |
Warm ++ |
37 |
wdFieldPageRef |
|
|
Hot |
48 |
wdFieldPrint |
|
PRINTDATE |
Warm ++ |
23 |
wdFieldPrintDate |
|
PRIVATE |
Cold |
77 |
wdFieldPrivate |
|
QUOTE |
Warm |
35 |
wdFieldQuote |
|
RD |
Cold |
11 |
wdFieldRefDoc |
|
REF |
Warm ++ |
3 |
wdFieldRef |
|
REVNUM |
Warm |
24 |
wdFieldRevisionNum |
|
SAVEDATE |
Warm ++ |
22 |
wdFieldSaveDate |
|
SECTION |
Warm |
65 |
wdFieldSection |
|
SECTIONPAGES |
Warm ++ |
66 |
wdFieldSectionPages |
|
SEQ |
Warm ++ |
12 |
wdFieldSequence |
|
SET |
Warm |
6 |
wdFieldSet |
|
SHAPE |
Hot |
95 |
wdFieldShape |
|
SKIPIF |
Warm |
43 |
wdFieldSkipIf |
|
STYLEREF |
Warm ++ |
10 |
wdFieldStyleRef |
|
SUBJECT |
Warm |
16 |
wdFieldSubject |
|
SYMBOL |
Hot |
57 |
wdFieldSymbol |
|
TA |
Cold |
74 |
wdFieldTOAEntry |
Table of Authorities Entry field. |
TC |
Cold |
9 |
wdFieldTOCEntry |
Table of Contents Entry field. |
TEMPLATE |
Warm |
30 |
wdFieldTemplate |
|
TIME |
Warm ++ |
32 |
wdFieldTime |
|
TITLE |
Warm |
15 |
wdFieldTitle |
|
TOA |
Warm |
73 |
wdFieldTOA |
Table of Authorities field. |
TOC |
Warm |
13 |
wdFieldTOC |
Table of Contents field. |
USERADDRESS |
Warm |
62 |
wdFieldUserAddress |
|
USERINITIALS |
Warm |
61 |
wdFieldUserInitials |
|
USERNAME |
Warm |
60 |
wdFieldUserName |
|
XE |
Cold |
4 |
wdFieldIndexEntry |
Index Entry field. |
How to create fields manually
A field added by pressing Ctrl+F9 in a Word document is an Empty field (wdFieldEmpty = -1, field kind None).
Instead of inserting fields via Insert tab > Quick Parts > Fields, you can create fields manually in Word:
- Press Ctrl+F9 to add an empty field.
- Type the relevant field code between the field brackets.
See the Microsoft article List of field codes in Word for information about the individual types of Word fields and their syntax. - Press F9 to update the new field.
If you know the syntax of the field you want to insert, the manual method is often the most efficient.
The kind of field will change from None / wdFieldKindNone to one of the other types once you add valid field code.
Field names are not case-sensitive
If you check the field codes of fields that are inserted in Word via the Fields dialog box (Insert tab > Quick Parts > Fields) or by using another command that results in a field being inserted (cross-reference, caption, date, etc.), you will see that Word will use UPPERCASE for the field name. Examples:
{ PAGE }
{ REF _Ref517270969 \h }
{ TOC \o "1-3" \h \z \u }
Field names are not case-sensitive. For example, a PAGE field will work no matter whether the type is written as PAGE, Page, page, pAge or any other combination of uppercase and lowercase.
How to update fields manually
Hot fields are updated automatically by Word as described above.
Some warm fields are updated automatically when the source changes. Warm fields that are not updated automatically by Word can be updated manually. You can use different methods as described below.
METHOD 1 - Select the field and update it
- Select the field you want to update.
If you want to update all fields in the current part of the document, press Ctrl+A to select all. - Press F9 to update all fields in the selection.
Alternatively, right-click and select Update Field from the context menu.
If the selection includes one or more TOC fields, you will be asked once per TOC how you want the table of contents to be updated.
Note that this method only works in the area of the document where the selection is. If there are fields in e.g. footnotes or endnotes, you need to select those areas individually and update fields.
TIP: If you experience that one or more cross-reference fields do not update as expected, see the article Cross-reference Problems - Troubleshooting.
METHOD 2 - Switch to Print Preview
As mentioned in the description of Warm ++ fields, they can be updated by switching to Print Preview. This method is not sufficient if other kinds of fields need to be updated.
- To quickly switch to Print Preview, press Alt+Ctrl+I.
- To quickly return to the previous view type, press Esc.
METHOD 3 - Update all fields in the entire document using a macro
You can update all fields anywhere in the document in one operation using a macro. You will, for example, find such macro here: UpdateAllFields macro.
How to make sure all fields are updated when printing
If you turn ON the option Update fields before printing, all fields in the document will be updated when you print. See the illustration below.
If the option Update fields before printing is turned OFF, only field in headers and footers and the fields listen in the warm ++ group will be updated when printing.
Note that this option is a global Word option that applies to the individual user's Word. It is not stored in the individual document. This means that you cannot rely on all users having this options set the same way unless it is managed by e.g. macros or Group Policy.
How to prevent fields from being updated
There may be situations when you want to prevent the result of a field from being updated. You can obtain this by locking the field. Locked fields will not change even if you update fields:
Another way of retaining the current field result is to convert the field to normal text. If you are sure you will never want a specific field to update, you can convert the field to normal text by pressing Ctrl+Shift+F9.
Related information
See the Microsoft article List of field codes in Word for information about the individual types of Word fields, their syntax and how to use them.
The Microsoft support article Some fields are updated while other fields are not lists fields that are updated automatically or updated e.g. when selecting Print Preview. However, the lists don't seem to be complete according to my experiments. In the lists above, you will see that more fields are listed in those categories than in the Microsoft article.
For details about cross-reference fields, see my article How cross-reference fields in Word work on my website wordaddins.com.
In case of problems with cross-reference fields not being updated as expected, see my article Cross-reference Problems - Troubleshooting.