troubleshooting Question

Leading zero in zipcode-mergefield in MS Word 2007 is not displaying

Avatar of vikasbapat
vikasbapat asked on
Microsoft Word
18 Comments1 Solution601 ViewsLast Modified:

I'm using MS Word 2007 document. In the document mergefields are used to insert some address data from database.
Issue is - When I get any 5/9 digit Zipcode starting with a zero, the leading zero is dropped out.

I tried one code like this -
mergefield ZipCode {if {mergefield ZipCode} > "99999" {mergefield ZipCode \#"00000'-'0000'" {mergefield ZipCode \"# "00000"}

Above is working fine for 9 digits zipcode starting with zero, however this not displaying the same code is not working for 5 digits zipcode.
eg., zipcode(02312-1234) with 9 digits is shwon as - 02312-1234
and 5 digits zipcode(02312) is displayed as - 00000-2312

Please reply if there's any good solution for this.
It should work for both 5 and 9 digits zipcode.


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 18 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros