Using Formatting Switches in Print Merge Fields

ID: Q71956

The information in this article applies to:

SUMMARY

The \*MERGEFORMAT switch and the \*CHARFORMAT switch can both be used in Word for Windows to ensure the character formatting of merged data. Because of the functionality differences between the two switches, the \*CHARFORMAT switch may be the better choice for character formatting in a print merge.

MORE INFORMATION

The \*MERGEFORMAT switch is designed to ensure that an updated field result will retain the formatting that was applied to the previous result of the field. When the \*MERGEFORMAT switch is placed in a field with a print merge bookmark, it will cause the results of the fields of a second merge to be formatted with the same formatting as the results of the fields of the last record in the first merge. The \*MERGEFORMAT switch will apply character and paragraph formatting.

If the \*MERGEFORMAT switch is in the print merge field before the first merge is performed, the formatting of the first character after the opening bracket will be applied to the result. (This function is similar to the \*CHARFORMAT switch discussed below).

One drawback of using the \*MERGEFORMAT switch in a print merge is a limitation on the number of words to which it applies. The character formatting will only be applied to the same number of words from the previous result.

For example, assume that in merge #1 the last result for the {company \*mergeformat} field is "Microsoft". After merge #1 is complete, you decide to apply bold formatting to all company names, so you highlight "Microsoft" or {company \*mergeformat} in the main document and apply bold formatting to it.

You then decide to change your data document to read "Microsoft Corporation." When you merge the second time, "Microsoft Corporation" will be the result of your {company \*mergeformat} field. However, only the word "Microsoft" will be bold; "Corporation" will be formatted with the original formatting of the result of merge #1 (that is, whatever it was before you made it bold).

For this reason, the \*CHARFORMAT switch may be a better choice for ensuring the character formatting of print merge fields. The formatting of the first character after the opening field bracket is applied to the field's result by \*CHARFORMAT. Previous formatting will be replaced completely. The formatting will apply to all characters in the result regardless of the length of the result.

The syntax for these switches in a print merge field is:

   {Bookmark \*mergeformat}

   -and-

   {Bookmark \*charformat}

In some cases, placing the \*CHARFORMAT switch in the DATA field only will cause all of the merge fields to take on the formatting of the first character in the DATA field. However, it will not affect the result of an IF field unless it is included in the IF field itself.

Reference(s):

"Word for Windows User's Reference," page 114.

KBCategory: kbprint KBSubcategory: kbmerge Additional query words: winword winword2 format font 1.0 1.10 1.10a 2.0 2.0a 2.0a-CD 2.0b 2.0c winword2 word6 6.0 6.0a 6.0c

Keywords          : kbmerge 
Version           : 1.x 2.x 6.0 6.0a 6.0c
Platform          : WINDOWS

Last Reviewed: July 31, 1997