Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

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

When you view the Set field in your document, the syntax looks like this:

{ SET Bookmark "Text" }

Note: A field code tells the field what to show. Field results are what’s shown in the document after having evaluated the field code. To toggle between viewing the field code and the field code results, press Alt+F9.

Instructions

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

To use the Set field in a document, do the following:

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

  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.

To use the Set field as part of a mail merge, do the following while you are setting up the mail merge:

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

  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.

Properties

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

Top of Page

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×