Word mail merge/Table formatting

  • Thread starter Thread starter Blesson
  • Start date Start date
B

Blesson

I am currently using a mail merge document to perform a function. The
document generates letters which contains a table with 4 columns and number
of rows. I am trying to set the mail merge document such that when I perform
the merge function every table within every letter that is generated is
sorted in ascending order. In short, I am trying to avoid going to each
letter and sort the tables manually.
Any help is appreciated.
 
Not sure how you are populating the table, but if you execute the merge to a
new document, you could run a macro containing the following code to sort
each of the tables.

Dim atable As Table
For Each atable In ActiveDocument.Tables
atable.Sort
Next atable

You may need to add a few more parameters to the .Sort command to achieve
exactly what you are after. Check out Sort in the Visual Basic Editor to
see the options that are available.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
Back
Top