#1
|
|||
|
|||
Mail Merge - Trailing Spaces
I am working with a mail merge file, and there are two fields that I need put on the same line. The first one is between 7-10 characters, and the second field is 4 characters. If the first field is less than 10 characters, it needs to have spaces filling the rest. I have tried to write a macro to put the trailing spaces in the field before it is merged but it took off the spaces. Is there a good way to do this?
|
#2
|
||||
|
||||
Hi osucjb,
Is there a reason you can't separate the two fields with a right-aligned tab attached to the second field?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Yes, These fields are converted to a barcode that is read by a barcode scanner so they have to be spaces if the field is not long enough.
|
#4
|
||||
|
||||
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} 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] |
#5
|
|||
|
|||
I'm after something similar. We are sending output from a merge to a virtual printer which takes the output and puts it into our electronic document imaging system.
While the actual printout and print-to-PDF options work just fine, when sent to the generic/text only printer the table is converted to text, which is expected, but unless each column has the same number of spaces the alignment is messed up. In other software like Excel this is easy to fix; I would change the field to be something like: Code:
mergefield + space(80-len(field)) currently it looks like this: Column1 Column2 Column3 Item1 desc $1234 $123 Item2 description $2341 $234 Item3 $4567 $456 For example, <<item>> the merge field, when populated, looks like this: Item Line1 CR/LF Item Line2 with more info CR/LF Item Line 3 still different length than Line1 & Line2 CR/LF I need to add spaces after Line1 & Line2 so they -at least- match the length of Line3 (or some static character length that suits, like 80). Again, this is in order to make Column 2 line up and not be "jagged". I will need to repeat this for the other columns as well. I don't believe I can have the user change the source data to match my requirements. I'm also fine if this requires some scripting in a macro, I'm just not sure how to get "there" from "here". |
#6
|
||||
|
||||
What you're asking for quite simply can't be done with a mailmerge.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
From a beginner: Mail Merge using Windows Mail | mhalpern705 | Mail Merge | 3 | 12-16-2011 04:58 AM |
New to mail merge help please | Keith | Mail Merge | 2 | 11-03-2011 03:56 AM |
Comma style without trailing zeroes but with decimal part | Scaffold | Excel | 3 | 10-22-2011 11:08 PM |
Saving INDV mail merges During the mail merge | sedain121 | Mail Merge | 2 | 10-04-2011 07:52 PM |
Mail Merge help | aman | Mail Merge | 0 | 05-07-2010 03:38 AM |