The SET field assigns specific information to a named variable, called a bookmark. For the information to appear in the document, you must insert a REF field that refers to the bookmark. You can also use the bookmark to process the information invisibly, such as in a macro or in another field, such as an IF field.

Syntax

{ SET Bookmark "Text" }

Note To see the field codes in a main document, press ALT+F9. To see field results again, press ALT+F9 a second time.

showProperties

Bookmark

The name that stands for the information: a variable - for example, InterestRate.

"Text"

Information that is assigned to the bookmark: a literal value. Enclose text in quotation marks; numbers don't require quotation marks. The information can be the result of a nested field.

Example

In the following example, a document contains the bookmarks EnteredBy, UnitCost, Quantity, SalesTax, and TotalCost. SET fields establish the contents of each of these bookmarks, and REF fields have been inserted in the document to display the contents of the bookmarks. A numeric picture switch displays the UnitCost and TotalCost values with a currency symbol and two decimal places.

{ SET EnteredBy "Yury Vronsky" }
{ SET UnitCost 25 }
{ SET Quantity { FILLIN "Enter number of items ordered:" } }
{ SET SalesTax 10% }
{ SET TotalCost { = (UnitCost * Quantity) + ((UnitCost * Quantity) * SalesTax) } }
This confirms your order of our book. You ordered { REF Quantity } copies at { REF UnitCost \# "$#0.00" } apiece. Including sales tax, the total comes to { REF TotalCost \# "$#0.00" }
Thank you for your order,
{ EnteredBy }

If the user types 3 in response to the prompt for the FILLIN field, the resulting document looks like this:

This confirms your order of our book. You ordered 3 copies at $25.00 apiece. Including sales tax, the total comes to $82.50.
Thank you for your order,
Yury Vronsky

Instructions

You can use the SET field in a document or as part of a mail merge.

showTo use the SET field in a document

  1. On the Insert tab, in the Text group, click Quick Parts, and then click Field.

    word ribbon image

  2. In the Field names list, select Set.
  3. In the Bookmark name list, select the name of a bookmark.
  4. In the Text box, type the text that you want to assign to the bookmark.
  5. Click OK.

showTo use the SET field as part of a mail merge

While you are setting up the mail merge, do the following:

  1. On the Mailings tab, in the Write & Insert Fields group, click Rules, and then click Set Bookmark.

    word ribbon image

  2. In the Bookmark list, select the name of a bookmark.
  3. In the Value box, type the text that you want to assign to the bookmark.