View Single Post
  #3   Report Post  
Posted to microsoft.public.word.tables
evg999
 
Posts: n/a
Default Macros:How to select a specific column of a table and format it using macro?

Hi Greg,

Thanks for mailing the macro.
Please check,
On trying to run it,
Compile error: Argument not optional" is displayed.
and .SetWidth is highlighted.

Thanks in advance,
Giri

Greg wrote:
With cursor in applicable table/applicable row, the following would
resize and set a font size value:

Sub FormatTableCol()
Dim oTbl As Table
Dim oCell As Cell
Dim i As Integer
Set oTbl = Selection.Tables(1)
i = Selection.Information(wdStartOfRangeColumnNumber)
oTbl.Columns(i).SetWidth ColumnWidth:=InchesToPoints(0.5),
RulerStyle:=wdAdjustNone
For Each oCell In oTbl.Columns(i).Cells
oCell.Range.Font.Size = 20
Next
End Sub