Bryan Carbonnell
carbonnb at gmail.com
Sun Mar 26 13:09:03 CST 2006
On 3/26/06, Arthur Fuller <artful at rogers.com> wrote:
> Is there a way to create a Word macro that will resize the columns of a
> given table to the sizes I want? The sizes themselves are constant. The
> names of the tables follow a general pattern but they might be hard to
> predict, so I would be happy to visit each table and press the macro key and
> have Word do the resizing for me.
> In fact there are 3 kinds of tables per report, so I would like to have 3
> such macros. Can this be done?
Sure, you can do something like:
dim tbl as Table
set tbl = activedocument.tables(1)
with tbl
.Columns(1).Width = inchestopoints(2)
.Columns(2).Width = inchestopoints(2)
.Columns(3).Width = inchestopoints(2)
end with
This will set Columns 1, 2 and 3 of Table 1 to 2" in width. If you
want to use centimeters then you would replace InchesToPoints with
CentimetersToPoints
Tables and columns are both 1 based collections.
--
Bryan Carbonnell - carbonnb at gmail.com
Life's journey is not to arrive at the grave safely in a well
preserved body, but rather to skid in sideways, totally worn out,
shouting "What a great ride!"