Exploring Office 2007: Finding Your Way with Word 2007 Fields

by Helen Bradley

Getting Work Done with Word 2007 Fields

From automatically inserting and formatting data to marking the place someone needs to type into a template, Word fields are the tool to use. Unfortunately, as useful as they are, Word doesn't make field codes easy to find and a quick first glance at the field codes dialog won't exactly enlighten you to their potential uses. However, we're about to lift the lid on field codes and introduce you to creating and using them and some handy things you can do with them.

What Are Field Codes?

Field codes are generally hidden so you might have used them before without knowing they were even there. They are used extensively in mail merge as placeholders in the merge document, marking where the fields from the data file will appear when the document is merged. However, merge is only a small sampling of what field codes are capable of doing.

One handy field code is the date field code. To add one to your document press Alt + Shift + D and the current date appears in your document. This is a field code that marks the place where the current date will be displayed in the document. Because it is a field code and not a hard-coded date, tomorrow it will read a different day.

To see the underlying code, click on the date and press Shift + F9. You will see something like:

{ DATE \@ "M/d/yyyy"}

This code inserts the date and formats it according to the format codes. You can change the codes, for example to read:

"MMM dd, yy"

Press Shift + F9 to hide the field code again and press F9 to update it. If today's date is January 10, 2008, your field code would have read 1/10/2008 and will now read Jan 10, 08.

DIY Field Codes

Instead of pressing Alt + Shift + D you could type the field code yourself. To do so, press Control + F9 to type the curly braces — these can't be entered from the keyboard and have to be typed this way. Now, click inside the braces and type the field code — for example, type:

{ DATE \@ "dd MMMM, yyyy"}

Press Shift + F9 to hide the code and press F9 to update it. Note that it's vital you use the correct case for the formatting — lower case m is used for minute format, not months, for example.

Shortcut Keys

There are some handy keys for working with field codes:

Shift + F9 – Toggles between displaying the selected field code and its results

Control + F9 – Inserts a set of field code markers (curly braces)

F9 – Updates a field code, and when used in combination with Control + A, all field codes in the document are updated

Alt + F9 – Toggles between displaying all the field codes in a document and displaying their results

Field Codes Dialog

In addition to typing your own field codes, you can insert field codes using the Field Codes dialog. From the Ribbon choose Insert > Quick Parts > Field to open the field codes dialog.

From the Categories list choose Date and Time and from the Field names list choose Date. If the button in the bottom corner reads Hide Codes, click it and choose a format from the list displayed. Click Ok to add the field to your document.

Template Prompts

One interesting use for field codes is as a marker for text to be inserted into a template. Consider the situation where you are making a template for someone else to use.

You can mark where they are to enter data with a special field code and the user will see a prompt inviting them to click and add their text. When they do so, the field code disappears to be replaced with their text.

This feature uses the MACROBUTTON field. Its real use is to run a named macro when the field is clicked. However if there is no macro to match the name in the field code it simply disappears. This is the behaviour you will use to make your [Click and type] block.

To do this, click where your user should type their text. Choose Insert > Quick Parts Field and from the Categories list choose Document Automation and from the Field names list choose Macrobutton. Click the Field Codes button to fill the Field Codes box. Edit the entry so it reads:

MACROBUTTON noname [Click and type the Customer's Name]

The entry noname can be anything as long as there is no macro with this name in the current file or the current template. The brackets are simply markers to indicate that this is a prompt — they don't need to be there and they could be replaced with anything or removed entirely.

Click OK and test the result. Press the Undo button to undo your typing and redisplay the field code.

You can create as many click here blocks in your document as you like and they can all use the same non existent macro name.

Viewing Field Codes

Word Options > Advanced group and locate the Show Document Content collection of options.

Field codes can be configured to have Field shading turned on always, when the field code is selected, or never, according to your preferences. The choice you make only affects the document on the screen and does not appear on any printed version.

Completing a Document

Another application for Word fields is in entering repetitive data into a document. Some legal documents and many forms require, for example, a person's name to be entered a number of times. You can do this by hand or you can have field codes do the work for you.

Start by describing the data that will be repeated. For each piece of data, such as a person's name, you will need a bookmark name for that code. So, if you want to add a person's name and their date of birth multiple times, you'll use one bookmark name for their name and one for their date of birth.

To do this, click at the top of the document and choose Insert > Quick Parts Field and from the Categories list choose Mail Merge and from the Field names list choose ASK. In the Prompt box type "What is the customer's name?".

In the Bookmark name box type custname, enable the 'Default response to prompt' checkbox and, in the box, type "Type the name here" and click OK. You'll see a small dialog appear displaying the question you just typed, do not complete it, just click Ok for now.

Repeat and add another ASK field for each piece of information. Each field must be given a different bookmark name.

Next you will add the markers where the text will go. To do this, first click in the position in the document where the first item will go and choose Insert > Quick Parts Field and from the Categories list choose Links and References and from the Field names list choose REF and click the Field Codes button.

Next to the word REF, type the bookmark name that matches the one in the ASK field for that piece of information. From the Format list choose Title Case (or the case to use if you want to format the entry), and click OK.

You will see that a prompt "Type the name here" appears in the document. Add Ref fields everywhere in the document that the data from the ASK fields should be inserted into the document. Save the document before continuing.

To test the result, open the document and press Control + A to select the entire document. Press F9 to update all fields in the document. When you do this, you will see a dialog appear asking the name of the customer &mdsah; type it and click OK.

Other dialogs will appear for every other piece of data to be inserted into the document. When you're done the document will be updated and the data inserted into position.

As you can see, Word fields are very flexible and can assist in document automation tasks.

Helen Bradley is a respected international journalist writing regularly for small business and computer publications in the USA, Canada, South Africa, UK and Australia. She blogs at http://www.projectwoman.com/blogger.html.

This article was originally published on Sunday Jun 8th 2008
Mobile Site | Full Site