Microsoft KB Archive/61850

Word: Text Field Data Ending in Spaces Ignored in Print Merge

PSS ID Number: Q61850 Article last modified on 03-07-1997

=
========================================================= 3.00 3.01 3.02 4.00 5.00 5.10 MACINTOSH kbprint ———————————————————————- The information in this article applies to:


 * Microsoft Word for the Macintosh, versions 3.0, 3.01, 3.02, 4.0, 5.0, 5.1 ———————————————————————-

= SUMMARY =

When doing a print merge in Microsoft Word, text fields that end with a space are ignored when using an IF statement to search for an exact text string. For example, if a field of a data document contains the following (where &quot;_&quot; denotes a space)

dollarfield $1,000_

if the associated main document contains the following IF statement (where &quot;_&quot; denotes a space), the condition of the IF will not be met:

<>< >< >

= MORE INFORMATION =

This problem most often occurs when copying dollar amounts from a Microsoft Excel worksheet to a data document in Word. Excel dollar amounts are formatted as having a preceding dollar sign, a trailing space, and sometimes an embedded comma, and are therefore considered to be text fields, not numeric fields.

To delete the space in Excel dollar amounts, follow these steps:


 * 1) In Excel, highlight all cells that are formatted as dollar amounts.
 * 2) Choose Number from the Format menu.
 * 3) Remove the space after the zero and before the semicolon in the Format box and click OK.
 * 4) Transfer the data from Excel to Word.

Note: Number fields that contain trailing spaces will not be ignored, but will generate the error “Not a valid integer for comparison.” Once the extra spaces have been deleted, the print merge can continue.

In Word versions 3.0x, the print merge feature completely ignores the trailing space in the IF statement. For example, if you have the statement <> in your merge document, the print merge finds all occurrences of “test” (without the space) but occurrences of “test” (with the space) are not found.

= STATUS =

Microsoft has confirmed this to be a problem in Word for the Macintosh versions 3.x, 4.0, 5.0, and 5.1. This problem was corrected in Word for the Macintosh version 6.0.

KBCategory: kbprint KBSubCategory: kbmerge Additional reference words: macword macword5 ====================================================================== ============================================================================= Copyright Microsoft Corporation 1997.