Add pop-up lists to your Word documents

By Bill Coan, Microsoft MVP

Applies to:
Microsoft Office Word 2003
Microsoft Word 2002

Click your way through changes in seconds

Do you reuse some of your documents over and over again, making slight changes just before you print, fax, or e-mail them each time? For example, do you send the same basic letter to each new customer, but edit the letter each time so that it refers to the specific product purchased by that customer?

Starting with Word 97, you can point to key words or phrases in your documents and right-click to switch to some other word or phrase. To accomplish this, all you have to do is set up an AutoTextList field for each key word or phrase.

 Note   If you're already familiar with AutoText entries and paragraph styles, or if you're not interested in "looking under the hood," feel free to skip over the following background items and jump right into the procedure that follows.

What is an AutoText entry?

AutoText entries are snippets of text or graphics or both that can be added to your document by choosing the desired entry from the AutoText toolbar. (To display this toolbar, right-click any other toolbar and click AutoText.)

Where do AutoText entries come from?

The default global template for Word, called Normal.dot, ships with numerous AutoText entries, but you can create additional entries and store them in Normal.dot or in any other template desired.

What is a paragraph style?

Paragraph styles are collections of paragraph properties that can be applied to a paragraph by clicking in that paragraph and then choosing the desired style from the drop-down list of styles on the Formatting toolbar. You can create new paragraph styles and store them in Normal.dot or in any other template or document.

What's the connection between paragraph styles and AutoText entries?

What few users realize is that Word organizes its AutoText entries by paragraph style. For example, if you click in a paragraph that has been styled as Product Name, the AutoText toolbar will automatically display only those AutoText entries that have been designated as Product Names (assuming there are any). The AutoTextList field has this same ability, except that it pops up the list of Product Names when you point to the field in your document and right-click.

Example: Create a pop-up list of products

Ready to create your first pop-up list? Don't be intimidated by the number of steps. Each step involves just one or two mouse clicks, and the entire set of steps can be completed in less than 5 minutes. Besides, you have to do this procedure only once for each list and then you can use the list over and over again, as needed.

Before you begin, you may want to print this procedure to guide you along the way.

  1. On the Standard toolbar, click the Show/Hide button to show paragraph marks, if it's not already displayed.
  2. Position the pointer in an empty paragraph.
  3. On the Formatting toolbar, in the Style list, click Normal, if it is not already displayed.
  4. Type your list of products, pressing ENTER after each product name.
  5. Select the entire list of products.
  6. On the Formatting toolbar, click in the Style box, type ProductStyle, and then press ENTER to create the new style.

Alternatively, in Microsoft Word 2000 on the Format menu, you can click Style and then click New. In Word 2002 and Office Word 2003, on the Format menu, you can click Styles and Formatting and then click New Style.

  1. Select each individual product name (being very careful not to select the paragraph mark after the name), press ALT+F3, and then click OK.
  2. Delete the list of products and again click the Normal paragraph style, if it is not already chosen.
  3. Press CTRL+F9 to insert a pair of field braces: { }
  4. Type the following expression between the field braces exactly as shown:

{ AutoTextList "product" \s "ProductStyle" \t "Right-click to select product" }

  1. With the insertion point still between the braces, press F9 to update the field. (If this fails to hide the field code, press ALT+F9 to hide the code.)
  2. Select the new field, being careful not to select the paragraph mark (¶) that follows the field.
  3. Press ALT+F3 and then click OK.

Insert a product list in your document

  1. Click where you want the list to appear.
  2. Start typing product. If Word to complete the typing for you, press ENTER or TAB to accept the AutoComplete suggestion.

If Word doesn't offer to complete the typing for you, select product and press F3.

Pop up the product list

  1. Point to product and right-click.
  2. Select the desired product.

How it works

The secret to the AutoTextList field is in the field code, repeated here for ease of reference:

{ AutoTextList "product" \s "ProductStyle" \t "Right-click to select product" }

Here's what each element of the code means:

AutoTextList    This is the field type. This particular type of field creates a pop-up list.

"product"    This is the field's default value. After the field is created, this value will be replaced when you right-click the field and select a different value.

\s "ProductStyle"    This tells the field that you want the pop-up list to display only those AutoText entries that were formatted with ProductStyle.

\t "Right-click to select product"    This tells the field to display a specific ScreenTip when you rest the pointer over the field.

Additional tips for advanced users

If you rely on different templates for different types of documents, make sure you're editing a template when you complete the procedure described above. At step 7 and again at step 13, instead of pressing ALT+F3, point to AutoText on the Insert menu, and then click AutoText. In the Look-in list, select your template and then click Add.

Don't delete the paragraph style that you created in step 6. If you do, your AutoTextList field will display all of your AutoText entries, not just the entries of the designated style.

In step 7, if you include the paragraph mark that follows the product name, the resulting AutoText entry will be inserted into your document with a paragraph mark, and the entry will be formatted with the style that you created in step 6. For most users, this is not desirable, but if this is what you want, by all means go ahead and include the paragraph mark.

To make it easier to see the lists that are embedded in a document, set the field codes to be shaded always. To do this, click Options on the Tools menu. On the View tab, in the Field shading list, click Always.

To navigate from field to field with the keyboard, press F11. To navigate backward from field to field, press SHIFT+F11.

To pop up the shortcut menu when the pointer is in an AutoTextList field, press SHIFT+F10.

If you don't like the Create AutoText command that appears at the bottom of the pop-up menu, click Customize on the Tools menu. On the Toolbars tab, in the Toolbars list, select the Shortcut Menus check box. On the Shortcut Menu menu that appears, in the Text list, click AutoTextListField. Drag the Create AutoText command from the menu to delete it, and then click OK.


About the author

Bill Coan is a solutions provider specializing in Microsoft .NET and XML solutions for Microsoft Office Word, as well as templates, macros, and add-ins for Word. He has authored numerous articles on the Word MVP Web site. His thoughts on Word and Microsoft Office have been featured in Office Watch, WordTips, eWeek, PC Magazine, PC PRO, Information Week, and the Microsoft Developer Network. He is the developer of the DataPrompter add-in for Microsoft Word for Windows and the MacSimplePrompter add-in for Microsoft Word for Mac. For more information, visit his Web site at http://www.wordsite.com.


 
 
Applies to:
Word 2003, Word 2002