Thread: [Solved] Mail Merge - Trailing Spaces
View Single Post
 
Old 12-16-2011, 08:18 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,374
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

In that case, you can use a series of tests, coded like:
Code:
{QUOTE "{MERGEFIELD Part_One}{IF{MERGEFIELD Part_One} = "???????" "   "}{IF{MERGEFIELD Part_One} = "????????" "  "}{IF{MERGEFIELD Part_One} = "?????????" " "}{MERGEFIELD Part_Two}" \* CHARFORMAT}
where Part_One is the name of your variable-length mergefield and Part_Two is the name of your fixed-length mergefield. Basically, the IF tests (the parts coded like {IF{MERGEFIELD Part_One} = "?" " "}) evaluate the length of the Part_One field and, according to that length, pad it out to 10 characters. The above coding representations cover from 7 to 9 characters in the Part_One data.

Note that 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.

Strictly speaking, the QUOTE field isn't necessary but, when used with the CHARFORMAT, means you need only apply your barcode font to the 'Q' in 'QUOTE' for the whole field to be barcoded. That'll make it easier to maintain later on.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote