Group:  Microsoft Word ยป microsoft.public.word.newusers
Thread: Word mail merge/Table formatting

Geek News

Word mail merge/Table formatting
Blesson 10/23/2008 4:13:01 PM
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.
--
BK
Phila, PA
Re: Word mail merge/Table formatting
"Doug Robbins - Word MVP" <dkr[ at ]REMOVECAPSmvps.org> 10/24/2008 3:55:38 AM
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

"Blesson" <Blesson[ at ]discussions.microsoft.com> wrote in message
news:6470C80B-D324-425E-A8D6-C6ABE2C71FED[ at ]microsoft.com...
[Quoted Text]
>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.
> --
> BK
> Phila, PA


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net