Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 10-27-2016, 05:58 AM
Trailblazer Trailblazer is offline Mail Merge - how to pad mergefields Windows 10 Mail Merge - how to pad mergefields Office 2016
Novice
Mail Merge - how to pad mergefields
 
Join Date: Oct 2016
Posts: 2
Trailblazer is on a distinguished road
Default Mail Merge - how to pad mergefields

We are sending output from a mail 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 item in a column has the same number of spaces the alignment is messed up between columns.

In other software like Excel this is easy to fix; I would change the field to be something like: mergefield + space(80-len(field)):

Code:
Currently it looks like this:
Column1              Column2            Column3
Item1 desc           $1234                $123
Item2 description       $2341               $234
Item3              $4567         $456


Should look like this:
Column1                 Column2            Column3
Item1 desc              $1234                $123
Item2 description       $2341                $234
Item3                   $4567                $456
I can't use len unfortunately. Another issue interfering with this (potentially) is that the mergefield is actually a collection of items separated with a CR/LF; it isn't just one item value but a "paragraph" of values.

For example, <<item>> the merge field, when populated, looks like this:

ColumnHeading CR/LF
Item Line1 CR/LF
Item Line2 with more info CR/LF
Item Line 3 still different length than Line1 & Line2 CR/LF

Making each line the same character width solves the alignment problem. The end user cannot change the source data to match my requirements. I'm fine if this requires some scripting in a macro, whether that macro works on the merge template or the finished merge documents; I'm just not sure how to get "there" from "here".

Thank you!
  #2  
Old 10-28-2016, 03:30 PM
macropod's Avatar
macropod macropod is offline Mail Merge - how to pad mergefields Windows 7 64bit Mail Merge - how to pad mergefields Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
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

I already answered that in this thread: https://www.msofficeforums.com/mail-...ng-spaces.html
Starting another thread with the same question isn't going to change the answer.

Thread closed.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge - how to pad mergefields Mail Merge is Deleting objects in my header and footer during the merge bgranzow Mail Merge 9 06-05-2015 05:03 AM
Mail merge how to link mail merge field value to a column heading dsummers Mail Merge 1 05-08-2014 02:59 PM
Mail Merge - how to pad mergefields Export data from C# winForms treeView to MS-Word MergeFields nisim651 Mail Merge 8 04-18-2014 04:17 AM
Mail Merge Duplication of address on merge RICKY Mail Merge 1 09-26-2012 03:14 PM
Mail Merge - how to pad mergefields Saving INDV mail merges During the mail merge sedain121 Mail Merge 2 10-04-2011 07:52 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:21 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft