WD98: How to Suppress Blank Spaces in a Mail MergeLast reviewed: February 3, 1998Article ID: Q179674 |
The information in this article applies to:
SUMMARYDuring a mail merge, you may want to eliminate blank spaces when there is no information available for a merge field in a line of text. This articles discuses why blank spaces occur, and it includes a method you can use to eliminate these blank spaces.
MORE INFORMATION
Why Do Blank Spaces Occur?Blank spaces occur most often in a mail merge when you use a title, honorific, or middle initial with a name. When these merge fields are used, a space is required between them and the name they refer to. If there is no data for that field, the extra space needs to be eliminated.
Using an IF Field to Remove an Unwanted Space CharacterYou can use an IF (conditional) field and make the space part of the conditional field so that when the field in question is empty, the space is not created. NOTE: In general, when you view a mail merge main document, merge field names appear in chevrons <<MERGE FIELD>>. To view the actual field codes that are in the document, press and hold the OPTION key and then press the F9 key to toggle the field codes off and on. Note also that the {} (curly brackets) that define a field cannot be simply typed. To create a pair of special brackets (create a field) press and hold the COMMAND key and then press F9. In the samples that follow <space> represents pressing the space bar once, while <Return> represents pressing the RETURN key once. In a main merge document a typical name line often resembles the following:
<<Title>><space><<FirstName>><space><<LastName>><Return>To see the actual field codes press, OPTION+F9. The resulting text will resemble the following:
{MERGEFIELD Title}<space>{MERGEFIELD FirstName}<space> {MERGEFIELD LastName}<Return>NOTE: Ignore the line wrapping on the screen for these examples. The line in the merge will actually end at the <Return>. The space after the Title merge field can be eliminated by placing the merge field and the space in an IF conditional field. The resulting field will look like this:
{IF {MERGEFIELD Title}<>"" "{MERGEFIELD Title}<space>"}The logic of the IF field reads "If the Title field ({MERGEFIELD Title}) is greater than or less than (<>) empty ("") (this is a programming way of saying not empty) insert what is in the Title field plus a space ("{MERGEFIELD Title}<space>") otherwise do nothing." To create the IF field for this example, follow these steps:
REFERENCESFor information about this subject in other versions of Word, please see the following articles in the Microsoft Knowledge Base:
ARTICLE-ID: Q72441 TITLE :WD: Suppressing Blank Spaces in a Print Merge (Mail Merge) Keywords : kbmerge Version : MACINTOSH:98 Platform : MACINTOSH Issue type : kbhowto kbinfo |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |