Word find all fields

In today’s article, we are thrilled to present you 3 quick ways to find all fields in your Word document.

By default, the fields we insert into Word document take the same text style as normal one. Therefore, you will find it hard to distinguish them from plain texts. This can leads to accidental editing or deletion of an important field. This article is dedicated to 3 quick workarounds to stand out fields.Find All Fields in Your Word Document

Method 1: Alter the “Word Options”

Generally, you can see the gray shading when you hovering cursor over a field. Such shading is like a kind of identification for field. The good news is you can turn it on even the cursor is not over a field.

  1. Firstly, click “File” tab.
  2. Then click “Options” to open “Word Options” dialog box.
  3. Next click “Advanced”.
  4. Scroll down to the “Show document content” section. Find the “Field shading” option and choose “Always” instead of the default “When selected”.
  5. Lastly, click “OK” to save the change.Click "Advanced"->Check "Always" for "Field shading"->Click "OK"

You need to be aware that this modification affects globally. Not only fields on this document but all other ones now have field shading.Effect of turning field shading on

Method 2: Use “Find” Function

  1. First and foremost, press “Alt+ F9” to show all field codes.
  2. Next click “Home” tab and click the arrow button behind the “Find” command.
  3. On the menu choose “Advanced Find” to trigger the “Find and Replace” dialog box.Click "Home"->Click the arrow button behind the "Find"->Choose "Advanced Find"
  4. Put cursor in “Find what” text box and enter “^d” to find all fields.
  5. Next click “Find In” and choose “Main Document”.
  6. You will see all fields are in selection now. You can choose to highlight them as to stand out.Enter "^d" in "Find what" box->Click "Find In"->Choose "Main Document"
  7. Finally, press “Alt+ F9” to toggle from codes back to text.

Method 3: Highlight All Fields via VBA

  1. To begin with, press “Alt+ F11” to quickly open VBA editor.
  2. Under “Normal” project, click “Insert” and choose “Module” to create a new one.Click "Normal"->Click "Insert"->Click "Module"
  3. Next double click to open the module as to bring out the editing area on the right side.
  4. Then paste the bellowing codes on the module:
Sub ShowFieldsInDoc()
  Dim objField As Field
  Dim objDoc As Document
  Dim strCodeText As String
 
  Set objDoc = ActiveDocument
 
  With objDoc
    For Each objField In .Fields
      If objField.Type = wdFieldRef Or wdFieldPageRef Then
        objField.Select
        Selection.Range.HighlightColorIndex = wdYellow
      End If
      If objField.Type = wdFieldHyperlink Then
        objField.Select
        Selection.Range.HighlightColorIndex = wdNoHighlight
      End If
    Next objField
  End With
End Sub
  1. Last but not the least, click “Run”.Paste codes->Click "Run"

This macro highlight fields in yellow, but leave hyperlinks intact whose default style is easy to recognize enough.

How to Efficiently Recover from Broken Files

Nowadays, it’s not unusual to encounter with docx damage, since we use Word so often to process documents. And you have to understand that being panic or mournful has nothing to do with efficient file recovering. Once file damage occurs, your primary option should be getting a fixing tool.

Author Introduction:

Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including xlsx damage and pdf repair software products. For more information visit www.datanumen.com

Please Note:
This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Finding Fields.

Written by Allen Wyatt (last updated November 21, 2020)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365


There may be times when you are working in a document and you want to search for fields that the document may contain. There are two very easy ways you can do this. The first is to go to the beginning of the document and simply press the F11 key. This causes Word to jump to the next field in the current document story, regardless of what that field does.

I should stop to explain what a story is. A story can be thought of as a portion of a document. The main document is a story, but there are other stories, as well. Common ones are the header, footer, footnotes, and endnotes. Pressing F11 will find the next field in the story in which the insertion pointer is located. Thus, pressing F11 if your insertion point is in the header will find the next field in the header. This means that you will need to place the insertion point in the story in which you want to find fields.

While pressing F11 may work great if you have only a couple of fields in a document, and they are in a single story, you can also use the Search capabilities in Word to search for fields. You do that by following these steps:

  1. Press Alt+F9. This makes all the field codes in your document visible, instead of the results of those fields.
  2. Press Ctrl+F. Word displays the Find dialog box (Word 2007) or the Navigation pane (later versions of Word).
  3. In the Find What box (Word 2007) or the search box (later versions of Word), enter ^d as what you are searching for (make sure you use a lowercase d). This is the code that Word understands as «any field.»
  4. Click on Find Next. Word locates the next occurrence of a field.

Notice step 1, which is required to make this method of searching for fields work. If you don’t display the field codes, Word can’t find the fields. Of course, you can always use the F11 method, which works whether they are displayed or not. (This seems very inconsistent to me. A field is a field, and should be found when searching for a field, whether it is displayed or not.)

One other inconsistency—the Search method will find fields regardless of the story in which they are located. Thus, it is a good choice if you have a lot of stories and each of those stories has fields with it.

WordTips is your source for cost-effective Microsoft Word training.
(Microsoft Word is the most popular word processing software in the world.)
This tip (9001) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365. You can find a version of this tip for the older menu interface of Word here: Finding Fields.

Author Bio

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. Learn more about Allen…

MORE FROM ALLEN

Understanding the Gutter Margin

Most everyone knows that Word allows you to set top, bottom, left, and right margins for your document. There is another …

Discover More

Adding Page Numbers

Ever want to add page numbers to your document? Word allows you to control many aspects of page numbering. Here’s how to …

Discover More

Applying Bold Italics

Applying bold and italics formatting to text is easy in Word. If you want to apply bold and italics simultaneously, you …

Discover More

It’s usually better to go the macro route when finding fields because, as you say, the find algorithm that Word uses doesn’t work the way you might hope with fields.

But if you know exactly what the fields contain, you can specify a search pattern that will probably work (however not in wildcard mode).

For example, if you want to look for figure number field pairs such as

{ STYLEREF 1 s }.{ SEQ Figure * ARABIC s 1 }

(which would typically be the same set of fields everywhere in the document)

If you only really need to look for the following:

{ STYLEREF 1 s }.<any field>

you could ensure that field codes are displayed and search for

^d STYLEREF 1 s ^21.^d

or

^19 STYLEREF 1 s ^21.^19

If you need to be more precise, you can spell out the second field as well.

«^d» only works for finding the field beginning, not the field end.

It’s a shame that ^w wants to find at least 1 whitespace character because otherwise it would be more robust to look for

^19^wSTYLEREF^w1^ws^w^21.^19

Perhaps someone else knows how to work around that without using wildcards?

Below the vertical scroll bar, there are three buttons: an up-arrow, a round thing, and a down-arrow.  Click on the middle one, which is “Select Browse Object” and can also be accessed as Alt+Ctrl+Home:

enter image description here

This gives you a 6×2 palette of browsable objects. 
Click on the {a}, which represents Fields.

enter image description here

Now “Next Find” (the down-arrow button,
also accessible as Ctrl+Page Down) and “Previous Find”
(the up-arrow button, also accessible as Ctrl+Page Up) become “Next Field” and “Previous Field”, respectively,
and you can use them to jump from field to field.

                enter image description here


The other boxes in the palette let you search / navigate for endnotes, footnotes, comments, section breaks, pages, edits (go back to the last three places you made changes), headings, graphics, tables, and, of course, ordinary text find.

If you work a lot with Word documents, you cannot avoid using fields. Fields in Word are used for many purposes such as page numbers, cross-references and tables of contents.

By default, a number of keyboard shortcuts have been assigned to operations related to Word fields. Using those shortcuts will help you save time and mouse clicks. Also, some operations on fields can only be performed using shortcuts or via code. 

In this article, you will find a list of useful Word field shortcuts including descriptions of how the shortcuts work.

About field codes and field results

Any field in Word consists of a set of curly field brackets, { }. Between the field brackets, you will find the field code that tells Word what to display, i.e. the field result. You can switch between displaying the field codes or the field results. You can only see the field brackets and field codes when field codes are displayed. To make sure fields show the correct results, they must be updated.

For details about how fields are updated, see my article Updating Fields in Word — How it Works. 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.

Examples of field codes
Page number: { PAGE }
Number of pages in a section: { SECTIONPAGES ]
Table of contents: { TOC o «1-3» h z u }

Short overview of field shortcuts — with names of related Word commands

For a quick overview of the Word field shortcuts, see the list below. For a detailed list with a description of each of the shortcuts, see Overview of Word field shortcuts — with detailed descriptions (found immediately below the short list).

The rightmost column shows the names of the Word commands that are executed by the shortcuts. Those names are the ones listed the Customize Keyboard dialog box in which you can modify keyboard shortcuts. To open the dialog box, select File > Options > Customize Ribbon > click the Customize button found next to the label Keyboard shortcuts. The Word command names can also be used in VBA.

  • Note that most of the keyboard shortcuts related to fields involve the F9 key.

Shortcut

What happens

Executes Word command

F9

Updates all fields in the selection

UpdateFields

Alt+F9

Toggles between field codes and field results of all fields

ViewFieldCodes

Shift+F9

Toggles between field codes and field results of selected fields

ToggleFieldDisplay

Ctrl+F9

Inserts a set of field brackets

InsertFieldChars

Ctrl+Shift+F9

Converts selected fields to normal text (unlinks the fields)

UnlinkFields

Ctrl+F11

Locks selected fields

LockFields

Ctrl+Shift+F11

Unlocks selected fields

UnlockFields

Overview of Word field shortcuts — with detailed descriptions

The list below shows the same shortcuts as listed above. The rightmost column includes detailed descriptions of the individual shortcuts.

Shortcut

What happens

More details

F9

Updates all fields in the selection.

A Word document consists of a number of stories: Main text story, header, footer, footnotes, endnotes, etc.

You can only select content in one story at a time. If fields are found in more stories, you will need to update fields in each story. Alternatively, you can use a macro to update all fields in one operation. I have created a free macro for that purpose: Macro – Update all fields.

Some fields are updated automatically. Other fields need to be updated manually. Some fields update when you switch to Print Preview. For detailed information about how the different types of Word fields update, see the article Updating Fields in Word — How it Works.

A field shows an error if Word cannot show the result specified by the field code. This happens, for example, if a cross-reference field refers to a heading or another target that is no longer found. You will then see a result like this:

Word field with error

The field can be updated to show the correct content when you have located and solved the problem. In some of the Word add-ins I have developed, I have made tools that can detect and correct some types of field errors. This is true for the add-ins DocTools CrossReferenceManager and DocTools DocPropertyManager.

Alt+F9

Toggles between showing field codes and field results ​of all fields in the entire document.

The field result is the content displayed in the final document. The field codes instruct Word in what to display. Below is an example of a field showing field result and field code:

Word field shortcuts - field result and field codes

Shift+F9

Toggles between showing field codes and field results ​of selected fields only.

If you need to see or modify the field code in a single or a few fields only, it is often practical to only show field codes of that/those fields.

You may experience that nothing happens when you press Shift+F9. This may depend on where the selection is. You can then either try to adjust the selection or you can use Alt+F9.

Alternatively, right-click and select Toggle Field Codes from the context menu — the same command as executed by the Shift+F9 shortcut. 

NOTE: To toggle the fields code of a single field, you do not need to select the entire field. It is sufficient that the cursor be in the field.

Ctrl+F9

Inserts a set of field brackets (an empty field), ready for manually adding the relevant field code.

Any Word field is enclosed in a set of field brackets.  You can insert nested fields, i.e. fields inside fields.

The field brackets look like curly parenthesis as in the REF field shown above. Note, however, that the field brackets cannot be typed as normal characters. You must use Ctrl+F9.

You can insert fields via the Field dialog box but it is often faster to create fields manually if you know the precise field code syntax.

Character codes for the field brackets:
Start field bracket: Character code 19.
End field bracket: Character code 21.

The curly brackets you can type using the keyboard have character codes 123 and 125, respectively.

Ctrl+Shift+F9

Converts selected fields to normal text. The field result of each field is preserved but the field itself is removed.

This is also referred to as unlinking fields.

You may want to convert fields to normal text in special situations.

For example, this may be useful if you need to copy content with fields to a destination where the fields will fail because there is no longer access to required data such as cross-reference fields that refer to targets that are not included in the copied range.

An alternative solution is to lock fields that are to be prevented from updating (see below).

NOTE: There is no command in the Word user interface to unlink fields. You must either use the shortcut or use code. The following VBA code will unlink all fields in the selection:

Selection.Fields.Unlink

Ctrl+F11

Locks selected fields, thereby preventing the field results from changing even if you update fields.

There may be situations when you want to prevent the result of a field from being updated.

Note that a locked field preserves its field result (the content shown in Word) even if you have made manual changes to the field result by modifying it directly.

If a field is not updated as expected, the problem may be that the field is locked. You can unlock locked fields. See below.

NOTE: You cannot see on a field whether it is locked. You can check via VBA whether fields are locked. The following VBA code will return True if the first field in the selection is locked:

Selection.Fields(1).Locked

NOTE: There is no command in the Word user interface to lock fields. You must either use the shortcut or use code. The following VBA code will lock all fields in the selection:

Selection.Fields.Locked = True

Ctrl+Shift+F11

Unlocks selected fields​​​​.

Locked fields will work as normally in relation to field updating once they are unlocked.

NOTE: There is no command in the Word user interface to unlock fields. You must either use the shortcut or use code. The following VBA code will unlock all fields in the selection

Selection.Fields.Locked = False

Recommendation — turn on field shading so you can distinguish fields from other content

Since the result of a Word field is determined by the field code and is often influenced by content elsewhere, it is important to be able to distinguish fields from normal text so you don’t accidentally change a field result by manually modifying its result. If you manually modify a field result, the change will disappear the next time the field is updated unless the field has been locked.

Therefore, I recommend that you set the Word option for Field shading to Always (File > Options > Advanced > Show document content group > Fields shading > Always). When field shading is set to Always, all fields are shown with gray shading on the screen as in the examples in the table above. The gray shading is only visible on the screen in Word — it does not print and it is not visible in PDF.

Related information

Learn the rules that apply to updating fields of different types in Word in the article Updating Fields in Word — How it Works.

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.

In case of problems with cross-reference fields not being updated as expected, see my article Cross-reference Problems — Troubleshooting.

Понравилась статья? Поделить с друзьями:
  • Word find all abbreviations
  • Word find about reading
  • Word find about christmas
  • Word find 100 words
  • Word final а word list