Word Macro to Format Tables
Use:
Dim i As Long
Dim myTable As Table
Dim myrange As Range
With ActiveDocument
For i = 1 To .Tables.Count
Set myTable = .Tables(i)
With myTable
Set myrange = .Range
Select Case myrange.Information(wdActiveEndPageNumber)
Case Is 99 201
.AutoFitBehavior wdAutoFitFixed
.Columns(1).Width = CentimetersToPoints(10)
.Columns(2).Width = CentimetersToPoints(2)
'.Columns(3).Width = CentimetersToPoints(#)
'.Columns(4).Width = CentimetersToPoints(#)
End Select
End With
Next i
End With
--
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, originally posted via msnews.microsoft.com
"Rage" wrote in message
...
Hi gang,
I have a 300-odd MS Word Document (Word Version 2003) with quite a lot of
tables, and I was wondering - can someone possibly provide me with a macro
which will take all the tables in a range (e.g.) pages 100 - 200, and set
the
width of each column to a specific value (e.g.) column 1 = 10 cm, column 2
=
20 cm etc.?
All the tables in the range needed have 4 columns, but each column needs
to
be a different value to the others.
Thanks in advance,
Rage.
|