Home > Sample chapters > Microsoft Office > Word

Mailing Paper or Pixels with Microsoft Word 2013

Adding merge fields

For a mail merge to place values from the data source into the output, you must insert one or more merge fields into the main document. During the merge, each merge field is replaced by the corresponding value in the data source for the current recipient. For example, suppose a recipient’s record in the data source contains the values First_Name = John and Last_Name = Clarkson. In the main document for a letter merge, a line might contain the merge fields «First_Name» «Last_Name». When the record is processed during the merge, those fields will be replaced with the text John Clarkson.

You can insert copies of the same merge field into the main document in multiple places. For example, the merge field «First_Name» could be used in the address, in the greeting line, and in the body of the letter.

Insert merge fields in the document

  1. Click in the main document at the location where you want information from the data source to be inserted during the merge.

  2. On the Mailings tab, in the Write & Insert Fields group, click the drop-down arrow on the Insert Merge Field button and then, in the list that appears, click the name of a column from the data source. Repeat steps 1 and 2 until the main document contains all the necessary merge fields.

    If you selected a label merge, insert merge fields and other text only in the upper-left cell of the table in the main document. During this step, the other cells contain only a «Next Record» merge field. The other cells will be filled in step 4 of this procedure.

    If you place another merge field on the same line as the first merge field, type a space, text, or punctuation between them as necessary. Otherwise, there won’t be any separation between the values in the output. If you want the next merge field to appear on the next line, press Enter at the end of the first line.

    httpatomoreillycomsourcemspimages1565323.jpg
  3. If you want, apply character formatting to some of the merge fields in the main document, either directly or by using a character style.

    You can right-click a merge field in the main document and click Toggle Field Codes to display the complete field code. Then, you can insert formatting switches to control the appearance of the results in the output. For information about inserting formatting switches, see “Controlling field formatting by using switches” on page 205.

    httpatomoreillycomsourcemspimages1565325.jpg
  4. If you selected a label merge, on the Mailings tab, in the Write & Insert Fields group, click Update Labels. This copies the merge fields and text that you entered in the upper-left cell of the table into all the other cells.

    httpatomoreillycomsourcemspimages1565327.jpg