VBA to Boldface Column of Table?

J

James Pannozzi

The Word 2000 object model does not
seem to support boldface of a table column
although it does support boldfacing a table row.

Has this been improved in Word 2003?

Is there a VBA way to select a table column and make the font
for all cells in that column bold??

Thanks
Jim
 
D

Dave Lett

Hi Jim,

You can probably use the following:

Dim oCol As Column
Set oCol = ActiveDocument.Tables(1).Columns(2)
oCol.Select
Selection.Font.Bold = True

HTH,
Dave
 
H

Helmut Weber

Hi James,
there is no column.range, due to the fact,
that word organizes tables in a linear way,
from left top to right bottom. To avoid side effects,
as unwanted formatting of neighbouring cells,
you have to address each cell separately and
avoid selection.range.
The following formats cells in the selection
and neighbouring cells (!)
from top left to bottom right:
Precondition is a selected column!
Dim oCll As Cell ' object cell
For Each oCll In Selection.Range.Cells
oCll.Range.Font.Bold = True
Next
This formats only (!) the cells in the selection:
Dim oCll As Cell ' object cell
For Each oCll In Selection.Cells
oCll.Range.Font.Bold = True
Next
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
 
J

James Pannozzi

Using selection, good idea.

Thanks!
J

Dave Lett said:
Hi Jim,

You can probably use the following:

Dim oCol As Column
Set oCol = ActiveDocument.Tables(1).Columns(2)
oCol.Select
Selection.Font.Bold = True

HTH,
Dave
 

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