TableColumnWidth

Syntax

TableColumnWidth [.ColumnWidth = number or text] [, .SpaceBetweenCols = number or text] [, .PrevColumn] [, .NextColumn] [, .AutoFit] [, .RulerStyle = number]

Remarks

Sets the column width and the space between columns for the selected cells. The arguments for the TableColumnWidth statement correspond to the options on the Column tab in the Cell Height And Width dialog box (Table menu).

Argument

Explanation

.ColumnWidth

The width to apply to the selected cells or columns, in points or a text measurement (.RulerStyle specifies how other columns are affected).

.SpaceBetweenCols

The distance between the text in each column, in points or a text measurement.

.PrevColumn

After the actions (if any) specified by the preceding arguments are carried out, selects the previous column.

.NextColumn

After the actions (if any) specified by the preceding arguments are carried out, selects the next column.

.AutoFit

Decreases the width of the selected cells as much as possible without changing the way text wraps in the cells.

.RulerStyle

Specifies how Word adjusts the table:

0 (zero) If there is a selection, only the selected cells are changed. Row width is not preserved. If there is no selection, Word sizes all cells in the selected column.

1 Word preserves row width by adjusting all cells to the right of the selection in proportion to their widths.

2 Word preserves row width by adjusting cells in the column immediately to the right of the selection only.

3 Word preserves row width by adjusting all cells to the right of the selection, assigning them each the same width.

4 Only the cell containing the insertion point (or the first cell in the selection) is changed. Row width is not preserved.


Example

For each table in the document, this example adjusts the width of the first column to 2 inches and the second column to 3 inches. The first TableColumnWidth instruction both formats the first column and moves the selection to the second column.


StartOfDocument
While ParaDown()
    If SelInfo(12) =  - 1 Then    'If insertion point is in a table
        StartOfRow
        TableSelectColumn
        TableColumnWidth .ColumnWidth = "2 in", .RulerStyle = 0, \
                .NextColumn
        If SelInfo(18) > 1 Then    'If more than one column
                TableColumnWidth .ColumnWidth = "3 in", .RulerStyle = 0
        End If
        LineDown
    End If
Wend

See Also

SelInfo(), TableDeleteColumn, TableRowHeight, TableSelectColumn