Nesting Fields

Sometimes, the best way to have one field's results affect another field is to nest the first field inside the second. This may sound abstract, but it is immensely useful.

To nest a field, first press Ctrl+F9 to create the field and edit the field as much as possible. Then, place the insertion point where you want the nested field to appear. Press Ctrl+F9 to insert a new field within your existing field. A sample (and simple) nested field follows:


{IF {DATE \@ "d-MMM" }=" 15-Apr"  "Have you paid your taxes or asked for an
extension yet?"  "Don't forget: tax preparation today can save you money
when April 15 rolls around!" }

In this example, the { IF } field checks the date returned by the { DATE } field. If the date and format match 15-Apr, Word inserts "Have you paid your taxes or asked for an extension yet?" If Word finds another date, it inserts "Don't forget: tax preparation today can save you money when April 15 rolls around!"

Here's a detailed example of how you can use nested fields to ask a user for an article name and then place that article name in the Summary Info tab of the Properties dialog box. After it's stored there, it can automatically be inserted anywhere else in the document you want, using another field.

Start by inserting a { SET } field, which sets a bookmark on the text that follows it. Call the bookmark Articlename:


{ SET ARTICLENAME }

Normally, the bookmark name would be followed by text. However, in this case, there is no text yet: You need to ask the user for it. You can use a nested { FILLIN } field that displays a dialog box asking the user to key in text:


{ SET ARTICLENAME { FILLIN "What is the article title?"  } }

Next, create another nested field that stores Articlename in the Title box of the Properties dialog box. This field also places the data in your document. You might use it in a document header or footer to automatically place your document's title there:


{ TITLE { REF articlename } }

Using this nested-field technique, you can ask a user for any information and automatically place that information in the Properties dialog box, where other fields can retrieve it and place it anywhere in the document you want.



    Part I: Word Basics: Get Productive Fast
    Part II: Building Slicker Documents Faster
    Part III: The Visual Word: Making Documents Look Great
    Part IV: Industrial-Strength Document Production Techniques
    Part VI: The Corporate Word