Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.tables
|
|||
|
|||
Macros:How to select a specific column of a table and format it using macro?
Hello,
Please update regarding how to: I have recorded a macro to convert text to table. but have problem recording selection of a particular column to format. I need to select a particular column and modify the formatting. like resize, change font... please mail how to do this and steps in vb. Thanks in advance, Giri |
#2
Posted to microsoft.public.word.tables
|
|||
|
|||
Macros:How to select a specific column of a table and format it using macro?
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 |
#3
Posted to microsoft.public.word.tables
|
|||
|
|||
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 |
#4
Posted to microsoft.public.word.tables
|
|||
|
|||
Macros:How to select a specific column of a table and format it using macro?
Giri,
Works fine here. Note that newgroup readers sometimes changes the line breaks on long lines. The lines should read: i = ... oTbl.Columns(i) ... RulerStyle:=wdAdjustNone For Each .. If breaks have been inserted to change this structure then rearrange accordingly. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Format and Formula in Table | Microsoft Word Help | |||
Format a number column in a table | Microsoft Word Help | |||
Table AutoFormats vs. Table Styles confusion | Tables | |||
How do I select specific information from an imported table | Tables | |||
Word 2003 Table AutoFormat vs Macro vs VBA | Tables |