View Single Post
  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Mail merge prints zip as 0 instead of correct code

If you find the problem Peter has alluded to, you can overcome the
problem by selecting the Zipcode cells in Excel and use Find/Replace,
with a hyphen as the Find character and nothing for the Replace
character. This will turn all the Zipcode text strings into Zipcode
numbers.


Just as a clarification,
a. if there are 9-digit ZIPs with hyphens, and the hyphens are there
because they have been entered in the ZIP, then yes, you would have to
remove the hyphens in the way you suggest. And AFAICS that would
actually result in the 5-4 ZIP being converted to a genuine number that
would then be displayed with whatever formatting has been applied to the
cell.
b. However, if there are also 5-digit ZIPs that were entered at a
point when the formatting of the cell was Text, then there won't be a
hyphen to find, nothing will change and the approach I suggested should
fix that (although perhaps some other substitution would also do it).

I dealt with option (b) primarily because that was the one that appeared
to be described in the original post.

Peter Jamieson

http://tips.pjmsn.me.uk

macropod wrote:
Hi Penelope,

If you find the problem Peter has alluded to, you can overcome the
problem by selecting the Zipcode cells in Excel and use Find/Replace,
with a hyphen as the Find character and nothing for the Replace
character. This will turn all the Zipcode text strings into Zipcode
numbers.

The only issue you might then have is that your mailmerge will omit the
hyphens for the 5+4 Zipcodes! If so, you can deal with this by adding
some logic to the Word document. A suitable field coding for this is:
{SET Zip {MERGEFIELD ZipCode}}{IF{Zip} 99999 {Zip \# "00000'-'0000"}
{Zip \# "00000"}}
where 'ZipCode' is the name of your Zip Code mergefield.

Note: The field brace pairs (ie '{ }') for the above example are created
via Ctrl-F9 - you can't simply type them or copy & paste
them from this message.