Field codes: MergeField field

{ MERGEFIELD FieldName [Switches]}

Displays the name of a data field (data field: A category of information that corresponds to one column of information in a data source. The name of each data field is listed in the first row (header row) of the data source. "PostalCode" and "LastName" are examples of data field names.) within the "chevron" merge characters in a mail merge main document (main document: In a mail-merge operation in Word, the document that contains the text and graphics that are the same for each version of the merged document, for example, the return address or salutation in a form letter.) — for example, «FirstName». When the main document is merged with the selected data source (data source: A file that contains the information to be merged into a document. For example, the list of names and addresses you want to use in a mail merge. You must connect to the data source before you can use the information in it.), information from the specified data field is inserted in place of the merge field.

In previous versions of Microsoft Word, merged documents frequently displayed double spaces in place of field (field: A set of codes that instructs Microsoft Word to insert text, graphics, page numbers, and other material into a document automatically. For example, the DATE field inserts the current date.) that mapped to missing data. Now you can use switches to specify which text is printed before or after the field results (field results: Text or graphics inserted in a document when Microsoft Word carries out a field's instructions. When you print the document or hide field codes, the field results replace the field codes.) (provided that the field contains data).

You must select the data source for the main document before you insert merge fields.

ShowInstructions

FieldName

The name of a data field listed in the header record of the selected data source. The field name must exactly match the field name in the header record.

ShowSwitches

\b

Specifies the text to be inserted before the MERGEFIELD field if the field is not blank.

\f

Specifies the text to be inserted following the MERGEFIELD field if the field is not blank.

\m

Specifies that the MERGEFIELD field is a mapped field.

\v

Enables character conversion for vertical formatting.

ShowExample

Placing the following three MERGEFIELD fields together and using the \f switch as specified ensures that the three fields have spaces between them, but only if the designated field information is present in the data source.

{ MERGEFIELD CoutesyTitle \f " " }{ MERGEFIELD FirstName \f " " }{ MERGEFIELD LastName }

Results in the following:

  • If all fields are present:
    Ms. Mindy Martin
  • If FirstName is missing from the data source:
    Ms. Martin

 Note   If you must change the field name specified in a merge field, edit the field name in the MERGEFIELD field codes (field code: Placeholder text that shows where specified information from your data source will appear; the elements in a field that generate a field's result. The field code includes the field characters, field type, and instructions.). Changing a field name with field codes hidden has no effect.

See Also:
See Also: