Posts Tagged ‘fields’


Word: Update all fields in a document

September 7, 2022

I thought I’d blogged about this years again, but apparently not!

If you need to update all the fields in your document, there’s a quick way to do it in Word for Windows:

  1. Turn OFF Track Changes.
  2. Check again that Track Changes is OFF (yes, I put this in twice because if track changes is on, you can get all sorts of problems).
  3. Go to File > Print, but DO NOT print anything. This puts the document into Print Preview mode, and doing that automatically updates most of the fields ready for printing.
  4. Click the back button to return to the document.

Most of the fields in all parts of the document will have updated, except perhaps the table of contents, list of tables and list of figures—update these manually.

Now check for and resolve any errors—search for Error! and if you use section numbering, search also for Section 0 (or Chapter 0 or Part 0, however you cross-reference the sections/chapters/parts in your document). Reassign the correct cross-reference for those that are broken. A broken cross-reference typically means that the section number, table, figure, or appendix no longer exists—if it has just moved, the number should have updated.


Word: Fields won’t update

January 18, 2019

I’ve been using Microsoft Word for Windows since about Word 2.0 (yes, more than two decades…) but sometimes it still stops me in my tracks with something I didn’t know existed. And I usually ‘find’ the thing that I didn’t know existed because I’ve come across something in a document that I can’t solve and have to investigate (search Google) to find the cause and the solution.

In a recent document I was editing, I could update the TOC, list of figures/tables, and the fields in the headers/footers using one or more of the usual methods (switch to Print Preview view then back to Print Layout; F9; right-click and select Update Field; update table of contents command etc.).

I’d assumed all the cross-referenced fields in the document had also updated and did my usual check for ‘Error!’ to find anything that broke during the update. On this document I fully expected several of them, but there were none. That in itself was a little unusual especially as I’d redone the Appendix headings, so the original cross-references to them should have broken. But what told me definitively that something wasn’t right was that old template used 3.0, 4.0 etc. for the numbered Heading 1 style, whereas the new template I’d transferred this document to used 3, 4, etc. When I Ctrl+clicked on a 3.0 cross-reference (for example) it went to the correct place. But why wasn’t the cross-reference showing as 3 instead of 3.0?

I thought I’d just try updating one of these cross-referenced fields, but when I selected it and right-clicked, Update Field was grayed out (greyed out). I’d never seen that before, so I tried a few more with the same result—I couldn’t update a cross-reference!

Off to Google… where I found that if the fields are locked (who knew?) then you get a grayed out Update Field option. I had no idea you could even lock fields (or why you’d want to), but I figured I’d try unlocking one of the fields using the method described to see if it worked. It did! Next, I tested (on a COPY of the document, as always) to see if I could select the entire document and apply the fix to ALL fields in the document—that worked too! Immediately all the fields in the document were now updatable.

The fix (test on a copy of your document first):

  • Press Ctrl+Shift+F11 on the locked field to unlock it.
  • To unlock ALL fields in the document, press Ctrl+A to select everything, then press Ctrl+Shit+F11 to unlock all the fields.

Thanks to Charles Kenyon for having a list of field functions, which is where I found this solution:

[Links last checked January 2019]



Word: Turn off Track Changes before updating fields

July 18, 2014

Based on a Writing Tip I wrote for my work colleagues…


Try to remember to turn off track changes before you update any fields in your document. If you don’t, things like automated caption numbering, the table of contents, the list of tables/figures, automated cross-references, etc. will all show tracked changes.

If you forget, don’t panic! Turn off track changes and update the fields again—that will get rid of most of the field update track changes so you won’t have to accept/reject hundreds of them manually.

Hint: A quick and easy way to turn track changes on and off is by pressing Ctrl+Shift+E.


Word: Putting the file path in the document

July 19, 2010

Bill, a work colleague, asked:

How do I insert the file path and file name into a footer? It was easy in Word 2003 but I can’t find a way in Word 2007. This is just to remind me where the hell I put it!!

I walked Bill through the steps, and also got him to turn on field shading so he would always know when any apparent text was actually a field.

Here’s how to insert a file path and file name into your Word 2007 document:

  1. Place the cursor where you want to insert the file path/name (this might be the main body of the document, the header or the footer).
  2. Go to the Insert tab > Text group.
  3. Click the Quick Parts button, then click Field near the bottom of the drop-down list.
  4. On the Field window, scroll down the list of Field Names and select FileName, then select the Add path to filename check box. (Adding the file path to the file name is very useful for everyone, but especially for those who save their documents on large corporate networks.)
  5. Click OK.
  6. The field is inserted into your document. If it’s a new document that you haven’t saved yet, you’ll see DocumentX as the file path (where X is the document number):
  7. Save the document, then place your cursor anywhere in the field and press F9 to update the field (or right-click in the field and select Update field). The field updates with the correct file name and path.

If you want the file name/path field to update automatically, you’ll need to do any of these:

Update: You can add this footer to your footer ‘Quick Parts’ gallery so that you don’t have to go through these steps every time.

  1. Once you’ve done all the steps above, select the footer contents.
  2. Click the small drop-down arrow to the right of Footer in the Header and Footer group on the Design tab.
  3. At the bottom of the drop-down list, click Save Selection to Footer Gallery.
  4. Complete the details and click OK. (Hint: If you want your footer to show at the top of this list in future, add a space or underscore before the name.)
  5. When you next want to add this footer to a document, open the footer, then just choose it from the Footer list (step 2).

(Thanks to James’ comment on 1 June 2012 for these steps.)


Word: Show those fields

April 19, 2010

When I’m working on a document with a lot of fields, I want to see exactly what’s a field and what isn’t. Did the author manually type Figure 3 or is it a field? You can’t tell just by looking at the text — unless you have field shading turned on, in which case all fields are shown with a gray background.

Is ‘Figure 3’ a field or not? If field shading is off, you can’t tell.

With field shading turned on, it’s absolutely clear that ‘Figure 3’ is a field.

To turn on field shading

Word 2010 and later:

  1. Click the File tab.
  2. Click Options.
  3. Click Advanced.
  4. Go to the Show document content section.
  5. Change the selection for Field Shading to Always.
  6. Click OK.

Word 2007:

  1. Click the Office button (top left corner), then Word Options.
  2. Click Advanced.
  3. Go to the Show document content section.
  4. Change the selection for Field Shading to Always.
  5. Click OK.

Word 2003:

  1. Go to Tools > Options on the menu.
  2. On the View tab, change the selection for Field Shading to Always.
  3. Click OK.

To turn off field shading, repeat the relevant steps above, but select Never from the Field Shading drop-down box.


Word 2007: Using SEQ fields for numbering

March 8, 2010

There are a couple of ways you can set up Word 2007/2010 to use SEQ fields for numbering — you can set them up as AutoCorrect entries or as Quick Parts. Both ways work; the method you choose is up to you. This long article describes how to create the SEQ fields and the numbering style in your Normal.dotm template; how to save the SEQ fields as AutoCorrect entries in Word 2007/2010 (and how to use them); and how to save (and use) them as Quick Parts. The most consuming part of this process is settings up the fields and the style; once they’re set up, using them is super easy.

Please note: While some of this information may be relevant to Word 2003, Quick Parts is new to Word 2007, so this article focuses on Word 2007/2010.

Create the SEQ field to reset the number to 1

  1. Right-click on the Normal.dotm template, then select Open (in Vista, the Normal.dotm template is stored under C:\Users\<username>\AppData\Roaming\Microsoft\Templates by default).
  2. Place your cursor on a blank line.
  3. Go to the Insert tab > Text group, then click the Quick Parts icon.
  4. Select Field.
  5. Select Seq from the list of Field names. SEQ displays in the Field codes text box on the right.
  6. Add this after SEQ: Step \r 1 (this will be the ‘reset numbering to 1’ field).
  7. Click OK. You should notice that ‘1‘ is inserted into the template. If you have field code shading turned on (Word Options > Advanced > Show Document Content section > Field Shading: Always), it will have a gray background.
  8. Press Enter to create a new line for the next SEQ field you’ll add — the one that will deal with all numbers other than 1.

Create the SEQ field for numbers other than 1

  1. Go to the Insert tab > Text group, then click the Quick Parts icon.
  2. Select Field.
  3. Select Seq from the list of Field names.
  4. Add this after SEQ: Step \n (this will be used for all numbers other than 1).
  5. Click OK. You should notice that ‘2‘ is inserted into the template if you added this field below the first one.

Add periods and tabs to the fields (optional)

  1. Make sure you have the Show/Hide marker turned on (Home tab, Paragraph group).
  2. Select the lines with 1 and 2 on them, then right-click and select Toggle Field Codes to display the code associated with these fields. Note: * MERGEFORMAT is added to the fields if you left the Preserve formatting during updates check box selected on the Field dialog box (this is the default).
  3. Position your cursor AFTER the closing curly bracket ( } ) of the first field, then add a period followed by a tab. Repeat for the second field.
  4. Leave the field codes displayed as you’ll need them later.

Create a new style for the SEQ field numbering

You won’t use any of the standard List Number styles for SEQ field numbering. You need to create your own style if you want correct indentation and alignment with the tab position of the first word after the number. In this example, I’ll create a new style called Step Number, but you can call it whatever you want. In this example, I’ve also used the default settings for tab and hanging indent positions — you can change these later if you want.

  1. Click the Styles dialog launcher on the Home tab > Styles group.
  2. Click the AA icon  at the bottom left of the Styles pane to create a new style.
  3. Give the new style a name — in this example, we’ll use Step Number.
  4. Make Step Number the Style for the following paragraph. Leave the other settings as they are for now — you can always change them later.
  5. Click Format, then select Paragraph to open the Paragraph dialog box.
  6. Adjust the paragraph settings to suit your preference, making sure you add a Hanging indent value (1.27 cm or 1/2 inch is the default).
  7. Click Tabs to open the Tabs dialog box.
  8. Set the left tab stop position (1.27 cm or 1/2 inch is the default).
  9. Click OK to close each dialog box.

Create the AutoCorrect entries for the fields

Note: AutoCorrect is one way to store and use the SEQ fields — you can use this AutoCorrect method and/or the Quick Parts method described later in this article.

  1. Make sure the field codes are displayed (see Step 2 in the Add periods and tabs section).
  2. Select the first field code (the SEQ Step \r 1 one), its following period and tab marker but DO NOT select the paragraph marker.
  3. Go to Word Options (under the Microsoft Office button) > Proofing.
  4. Click the AutoCorrect Options button.
  5. Your selection is already displayed in the text box on the right and Formatted text is already selected. In the Replace text box, type 1] (Why ‘1]’? Because you’re unlikely to use this sequence of characters in normal writing, and because it’s what David Knopf suggested back in his original article — and why change something that works?)
  6. Click Add then click OK.
  7. Select the second field code (the SEQ Step \n one), its following period and tab marker but DO NOT select the paragraph marker.
  8. Go to Word Options (under the Microsoft Office button) > Proofing.
  9. Click the AutoCorrect Options button.
  10. Again, your selection is already displayed in the text box on the right and Formatted text is already selected. In the Replace text box, type n] .
  11. Click Add then click OK.

Test your AutoCorrect numbering

  1. Go to a blank line anywhere in the document.
  2. Type 1] and press Enter. You should see 1. and a tab space.
  3. Type n] on the next line and press Enter. You should see 2. and a tab space.
  4. Type n] on the next line and press Enter. You should see 3. and a tab space.
  5. Type 1] on the next line and press Enter. you should see 1. and a tab space — remember, 1] resets the numbering to 1.
  6. Select all numbered lines and apply the Step Number style to them. To check the indentation, alignment and text wrapping, add placeholder text for each numbered item.

Create Quick Parts for the fields

Note: Quick Parts is one way to store and use the SEQ fields — you can use this Quick Parts method and/or the AutoCorrect method described earlier in this article. As far as I can tell, you do not have to have the field codes displayed to add these fields as Quick Parts, but it may be easier to see which is which if you do.

  1. Select the first field code (the SEQ Step \r 1 one), its following period and tab marker but DO NOT select the paragraph marker.
  2. Go to the Insert tab > Text group, then click the Quick Parts icon.
  3. Select Save Selection to Quick Part Gallery.
  4. Give the new building block a Name (in this example, I’ve used SEQ Step 1) and add a Description (optional). Leave the other settings as they are for now — you can always change them later.
  5. Click OK.
  6. Select the second field code (the SEQ Step \n one), its following period and tab marker but DO NOT select the paragraph marker.
  7. Go to the Insert tab > Text group, then click the Quick Parts icon.
  8. Select Save Selection to Quick Part Gallery.
  9. Give the new building block a Name (in this example, I’ve used SEQ Step n) and add a Description (optional).
  10. Click OK.

Test your Quick Parts numbering

  1. Put your cursor on a blank line in your document.
  2. Go to the Insert tab > Text group, then click the Quick Parts icon. Your two new Quick Parts entries are listed in the drop-down — hover over each to see the Description you added displayed as a tooltip.
  3. Click SEQ Step 1 to insert a 1. into the document. Press Enter to go to the next line.
  4. Click the Quick Parts icon again, and this time select SEQ Step n to insert 2. into the document.
  5. Repeat step 4 to keep adding numbers to the sequence.
  6. When you want to start a new number sequence, click the Quick Parts icon and select SEQ Step 1.
  7. Select all numbered lines and apply the Step Number style to them. To check the indentation, alignment and text wrapping, add placeholder text for each numbered item.

Clean up your template

  1. Before saving these changes to your Normal.dotm, remove all text and fields from the document.
  2. Save the template, and say Yes to saving the changes to the Building Blocks document as well.

That’s it! From now on, all you have to do to add SEQ field numbering is either type in your AutoCorrect text (1] and n]) or select the options from your Quick Parts list. If you find your numbering gets out of whack (remember, the numbers don’t update when you insert a new number between two existing numbers, or delete a number), select the sequence and press F9 (Hint: To update all fields for the entire document, press Ctrl+A then F9).


Linking to a step number

Using SEQ fields gives you the extra benefit of being able to link to step numbers in the text. You cannot do this in Word using standard number styles or automated numbering. Here’s how:

  1. Select the SEQ field number you want to link to — don’t select the period, the tab, any of the text, or the paragraph marker.
  2. Go to the Insert tab > Links group and click the Bookmark icon.
  3. Give the bookmark a unique but meaningful name, then click Add. (For example, if the step describes how to print, then use print as the bookmark name.)
  4. In the body of the text place the cursor where you want to refer to that step, then go to the Insert tab > Links group and click the Cross-reference icon.
  5. Change the Type to Bookmark, and leave the Insert reference to as Bookmark text.
  6. Click Insert, then Close.
  7. The text now displays the step number — if you later remove a step before this step, just update the fields with F9 and the cross-reference will update to display the correct number.

See also:

[Link last checked July 2014]


Word: Macro to fix Track Changes/Cross References issues and accept all field changes

October 16, 2009

The problem

When all Track Changes have not been accepted, you may not be able to insert a cross-reference to a table or figure caption correctly. Either you see multiple instances of the caption listed in the Cross Reference dialog box, OR you don’t see the caption at all, OR you see an incorrect table/figure number for the caption (e.g. you see Table 5.1 instead of Table 1.1).

This is a known issue with Word since at least Word 2000 (see the list of resources at the end of this post).

The issue

You’d think that accepting all changes would be sufficient. And it is. But accepting all changes is not appropriate where you have a document that MUST keep Track Changes on, such as one that has to go through a regulatory compliance process through all its revisions. I have been working on these types of documents. In Word 2003, it was never really an issue — double-upped cross-references were an annoyance more than anything, and we never noticed any that were missing. But as soon as my client started using Word 2007, we came across serious issues with existing table and figure captions not being listed in the Cross Reference dialog.

A little testing showed that it was related to Track Changes being on and the acceptance of all changes in the document. Armed with that knowledge, I headed off to trusty Google to try to find a solution — a solution that allowed cross-reference and caption fields (and lists of tables and figures) to be updated without affecting other parts of the document.


Macropod (clever name!), a Microsoft Word MVP, had posted a macro that solved the problem ( It worked great, but it dropped me into the footer and into Draft view at the end of the document when it was finished. So I posted my request to the Microsoft Word Programming Discussion Group, and the ever-helpful Macropod tweaked his/her original macro to get me what I wanted, which was to return to where I was when I ran the the macro.

Here’s Macropod’s revised macro:

Sub AcceptTrackedFields()
Dim oRng As Range ' All Range objects - includes ranges in the body, Headers , Footers &amp; Shapes
Dim Fld As Field ' Field Object
Dim oView As Variant ' The original document view
Dim SelRng As Range ' The original selection
' Turn Off Screen Updating
Application.ScreenUpdating = False
With ActiveDocument
oView = ActiveWindow.View.Type
Set SelRng = Selection.Range
' Loop through all range objects and accept tracked changes on fields
For Each oRng In .StoryRanges
For Each Fld In oRng.Fields
Set oRng = oRng.NextStoryRange
Loop Until oRng Is Nothing
End With
With ActiveWindow
If .View.SplitSpecial = wdPaneNone Then
.ActivePane.View.Type = wdPrintView
.View.Type = wdPrintView
End If
.View.SeekView = wdSeekMainDocument
.View.Type = oView
End With
' Restore Screen Updating
Application.ScreenUpdating = True
End Sub

Thanks heaps, Macropod! The generosity of the Microsoft MVPs and community is humbling.

See also:

Some websites that discuss this issue

See also:

[Links last checked October 2009]


Word: Use StyleRef field to populate header/footer

January 30, 2009

Many corporate documents require you to have a table near the beginning of the document with details such as the author, the date created, a revision number etc. You may also be required to insert some of these details into the header and/or footer of the Word document.

While you can set up all sorts of macros, cross-references, document property fields etc. to do this, here’s a really quick solution using styles and the StyleRef field. This solution works in Word 2003, Word 2007 and Word 2010 at least. Before attempting this, you should know how to create a new style in your version of Word. Note: The StyleRef field will NOT ‘see’ any styles used in text boxes (see the comment from November 2017 below).

  1. Create new styles for the text elements you want to capture. Give these styles names that are unique and are unlikely to be used anywhere else in the document (this is critical).  For example, DocAuthor, DocDate, DocTitle, DocRevNum. Don’t worry about formatting — the header/footer styles will control that.

    Create new styles

    Create new styles

  2. Fill in the details in the document information table (create a table if it doesn’t already exist).
  3. Apply the relevant styles to each cell of the document information table — e.g. apply the DocTitle style to the cell containing the title.  DO NOT apply these styles anywhere else in the document — only one paragraph/cell in the entire document should have this style applied to it otherwise this solution won’t work.

    Apply the new styles to the relevant cells

    Apply the new styles to the relevant cells

  4. Open the header or footer (Word 2003: View > Header and Footer; Word 2007/2010: Insert > Header > Blank then remove the control OR double-click in the header space to open the header).
  5. Insert a StyleRef field for each of the elements you want to populate.  To insert a field: Word 2003: Insert > Field; Word 2007/2010: Insert > Quick Parts > Field. Select StyleRef from the list of field names on the left (1), then select the style (e.g. DocAuthor) from the list of style names on the right (2), and click OK (3).

    StyleRef field

    StyleRef field

  6. Repeat step 5 for the other StyleRef fields you want to add. Add words, spaces, punctuation etc. between the fields, as required.

    Header created from the styles

    Header created from the styles

  7. Voila! Instant header/footer populated with the document details. And even better — as soon as you update any of the data in the cells, the header/footer automatically updates too.

    Instant update

    Instant update

If you want to see what’s going on behind the scenes, you can always toggle the field codes in the header/footer to see how it works:

Raw field codes

Raw field codes

(Thanks to Ken E on the STC Lone Writers discussion list who shared this technique with us.)


Word: Update fields in headers and footers

January 25, 2008

You’ve got a Word document with field codes in it (e.g. auto generated TOC, bookmarks and cross-references, file name in the footer etc.). But when you update the fields using F9, the fields in the headers and footers don’t get updated. Frustrated, you realize you have to go in to the header and footer separately, select all, then press F9.

But you don’t. There’s an easier way to update all fields at once, even those in the headers and footers.

Word 2003

  1. Switch from Print Layout mode to Normal Layout.
  2. Press Ctrl+A to select the entire document.
  3. Press F9 to update the fields.
  4. Switch back to Print Layout mode.

Word 2010 and later

Here’s how easy it is to do in Word 2010 and later: Go into Print Preview mode (File > Print, but DO NOT print), then return to the document. (Thanks to Greg Maxey on the Microsoft Office Discussion Forum for that trick!)

If not everything updates successfully with the Print Preview trick (some fields don’t appear to), you may need to try some of these options:

If you create one of these macros but don’t add it to the Quick Access Toolbar or to a keyboard shortcut, then you will need to run it manually (Developer tab, > Macros > select the macro name, then click Run). There’s probably a way to add them to the AutoOpen or AutoClose functions, but I haven’t checked that out. If anyone can alert me to a web page that discusses how to do this, I’d be most grateful (I’m a bit of a newbie with macros!)

[Updated with revised Word 2010 and later information, June 2009]