How do I format multiple tables in MS word together?

L

lebur05

I am using a program that generates a MSWord doc. The tables generated in the
docs have columns that a different widths.

Is there a way to set the column widths for all the tables to one standard
width without having to manually change each table?

Thanks
 
J

Jay Freedman

lebur05 said:
I am using a program that generates a MSWord doc. The tables
generated in the docs have columns that a different widths.

Is there a way to set the column widths for all the tables to one
standard width without having to manually change each table?

Thanks

If you want all the columns to be the same widths across each table (so in a
3-column table each column is 1/3 the page width, in a 4-column table each
is 1/4 the page width, and so on), use this macro (see
http://www.gmayor.com/installing_macro.htm if necessary):

Sub AllTablesUniformCols()
Dim oTbl As Table

For Each oTbl In ActiveDocument.Tables
oTbl.Columns.DistributeWidth
Next oTbl
End Sub

If all the tables have the same number of columns, but they need to be of
different widths, you can do something like this instead (adjust as
necessary):

Sub AllTablesSetWidths()
' assumes every table has 3 columns
Dim oTbl As Table

For Each oTbl In ActiveDocument.Tables
oTbl.Columns(1).Width = InchesToPoints(1.5)
oTbl.Columns(2).Width = InchesToPoints(2.5)
oTbl.Columns(3).Width = InchesToPoints(1.7)
Next oTbl
End Sub

If neither of these is suitable, describe your tables in more detail, and we
can probably work something out.
 
D

Doug Robbins

This is one thing where recording a macro may give an acceptable result.

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