WD: Suppressing Blank Spaces in a Print Merge (Mail Merge)

ID: Q187310

The information in this article applies to:

SYMPTOMS

When you perform a print merge (or mail merge) in Word for Windows, a blank space is displayed and printed if one field on a line is blank. A common example of this situation is a line with three name fields, such as the following:

   {FNAME} {MI} {LNAME}

In a record where all three fields are filled, the merged record spacing is correct, as in the following example:

   John R. Doe

In a record where the middle initial field {MI} is blank, an extra space occurs in the merged record, as in the following example:

   Jane  Doe

NOTE: There are two spaces between the {FNAME} and {LNAME} results.

RESOLUTION

You can eliminate this extra space by using the conditional IF statements as in the following examples:

The following conditional IF field will eliminate a blank space caused by an empty middle initial field:

   {FNAME} {IF {MI} <> "" "{MI} "}{LNAME}

The following conditional MERGEFIELD field will remove blank spaces in any field. For example, given the following fields,

   {Prefix} {FirstName} {LastName}

the following conditional statements will properly suppress the space normally included for any blank fields:

   {IF {MERGEFIELD Prefix}<>"" "{MERGEFIELD Prefix} "}
   {IF {MERGEFIELD FirstName}<>"" "{MERGEFIELD FirstName} "}
   {IF {MERGEFIELD LastName}<>"" "{MERGEFIELD LastName}"}

NOTE: To enter the field characters ({}), choose Field from the Insert menu (or press CTRL+F9).

REFERENCES

"Microsoft Word for Windows User's Reference," pages 97-98, and 200

"Microsoft Word for Windows and OS/2 Technical Reference," pages 41-42

Keywords          : kbdta wordnt kbfield winword kbmerge ntword word6 winword2 word7 word95 
Version           : WINDOWS:1.0,1.1,1.1a,2.0,2.0a,2.0a- CD,2.0b,2.0c,6.0,6.0a,6.0c,7.0,7.0a; WINNT:6.0
Platform          : WINDOWS winnt
Issue type        : kbprb

Last Reviewed: February 13, 1999