Microsoft Word: Working with Field Codes

Some of Word’s most powerful features are hidden from view, and one of these is field codes. While you may have encountered field codes when using mail merge, that’s not the only task you can accomplish with field codes. In this article we’ll look at how you can use field codes by themselves and in conjunction with bookmarks to create smart Word documents.

Let’s see a field code at work. To begin:

  • Choose Insert > Field
  • From the Categories list choose Date and Time
  • From the Field Names list choose Date
  • Select the date format you want from the Field Properties list
  • Click OK

What you see on the screen depends on your particular Word setup. You may see today’s date formatted in the style that you selected, or you may see a field code on the screen that looks something like this:

{ DATE  @ “dddd, MMMM dd, yyyy”  * MERGEFORMAT }

Click-Here field screenshot
A Click-Here block can be created using the MacroButton Word field.
(Click for larger image)

If you see the date rather than the field code, press the Alt + F9 keyboard buttons simultaneously to toggle between displaying field codes and the field code results. The field code you see is created inside a set of curly braces.

While it appears that you could type the curly braces on the keyboard to create your own field codes this is not the case, and these braces are special characters that can be inserted only by pressing the Ctrl + F9 key combination.

Another handy field code keyboard shortcut is Shift + F9 – use this when you are positioned inside a field code to toggle between displaying the field code and displaying the results for this field code only.

To manage how Word displays field codes, choose Tools > Options > View tab. You can select whether field codes show in the document or not (disabling this is the preferable setting) and when to shade the fields: Never, Always or When Selected. Selecting Always or When Selected may assist you in getting started with field codes and the shading won’t display when you print the document.

Click-Here Blocks

One way to harness field codes to help create smart documents is to use them for Click-Here blocks. You click on these markers in your document to enter text. These boxes help ensure that text is positioned correctly, and they provide a useful prompt for the user. To make one

Click an area in the document where you want people to type some text, and

  • Choose Insert > Field
  • From the Categories dropdown list choose Document Automation
  • From the Field Names list choose MacroButton and click the Field Codes button in the bottom left corner of the dialog

In the Field Codes area you should see the word MacroButton followed by some text. Remove the text and replace it with the following text so the Field Code looks like this: MACROBUTTON ClickHere [Type Recipient’s name in here]

Now click OK.

ASK field screenshot
The ASK field sets up the bookmark you will use for entering text.
(Click for larger image)

If you see the field code, press Alt + F9 so that you see just the prompt on the screen inside its square brackets. You can save this file either as a regular document or as a template.

Open the file or create a document based on the template and ‑ to see how the click-here block works ‑ click the prompt and type some text. When you do this, the field code disappears to be replaced by the text that you typed.

The basis for this click-here block is the MacroButton field code that is typically used to run a macro. However you can trick it into acting as a click-here block by typing a macro name that does not exist. The text you place in the square brackets is the prompt that will show on the screen. The square brackets are optional but they make the click here block look more professional.

You can create multiple click-here blocks in one document – use the same macro name and just change the prompt for each of them.

Must Read

Get the Free Newsletter!

Subscribe to Daily Tech Insider for top news, trends, and analysis.