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 }<space>"}
             {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}<space>"}{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


KBCategory: kbusage
KBSubcategory: kbmerge
Additional query words: 6.0 6.0a 6.0c 6.0.1 incorrect word6
conditional suppression winword macword ntword mergefield suppress
word7 blank space merge field word95 7.0 wordnt 7.0 6.0.1a word97
Keywords : kbmerge kbfaq
Version : 6.0 6.0a 6.0c 7.0 7.0a 97
Platform : MACINTOSH WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: August 4, 1997
©1997 Microsoft Corporation. All rights reserved. Legal Notices.