Microsoft KB Archive/132205

= Microsoft Knowledge Base =

WD: Blank Spaces Not Suppressed During Conditional Mail Merge
Last reviewed: August 4, 1997

Article ID: Q132205

The information in this article applies to:


 * Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
 * Microsoft Word for Windows 95, versions 7.0, 7.0a
 * Microsoft Word for Windows NT, version 6.0
 * Microsoft Word for the Macintosh, versions 6.0, 6.0.1, 6.0.1a
 * Microsoft Word 97 for Windows

SYMPTOMS
If you use the Mail Merge Helper to set up a main document and attach a data file, you can add conditional MERGEFIELD statements by choosing the Insert Word Field button. Using this option can produce incorrect results during the merge unless you add a space before the ending quotation mark after {MERGEFIELD title} in the true test and remove the space between the conditional MERGEFIELD field and the subsequent MERGEFIELD field. Below is an example of how the field is incorrectly inserted into the document using this method:

{ if { MERGEFIELD title } <> "" "{ MERGEFIELD title }" "" } {MERGEFIELD name}

STATUS
Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

RESOLUTION
Unless you modify the conditional field so that the space is included as part of the conditional statement--instead of between the conditional field and the subsequent field--the result will be no space when the conditional field is true and one space before the subsequent field when the result is false.

Condition 1: When the first field in a series of fields is the conditional

argument, modify the conditional line so that it reads as            follows:

{if { MERGEFIELD title } <> "" "{ MERGEFIELD title } "} {MERGEFIELD name} Condition 2: When the conditional field appears in the middle of a series

of fields, modify the conditional so that a space is included in the true test immediately following {MERGEFIELD middle} but before the ending quotation marks. The field should look like this:

{MERGEFIELD firstname} {if{MERGEFIELD middle}<> "" "{MERGEFIELD middle} "}{MERGEFIELD lastname} NOTE: A similar problem occurs in which Word does not suppress blank lines in a conditional mail merge. For additional information on this topic, please see the following article in the Microsoft Knowledge Base:

ARTICLE-ID: Q116360 TITLE    : Blank Lines Not Suppressed During Conditional Mail Merge