Word mail merge/Table formatting

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.
 
D

Doug Robbins - Word MVP

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top