SetWidth Method

See Also         Example         Applies To

Sets the width of columns or cells in a table.

Syntax

expression.SetWidth(ColumnWidth, RulerStyle)

expression   Required. An expression that returns a Cell, Cells, Column, or Columns object.

ColumnWidth   Required Single. The width of the specified column or columns, in points.

RulerStyle   Required Long. Controls the way Word adjusts cell widths. Can be one of the following WdRulerStyle constants.

Constant Description
wdAdjustFirstColumn Sets the width of the cells in the first column only to the specified value. If there is more than one column, Word preserves the right edge of the table and the positions of the other columns.
wdAdjustNone Sets the width of all selected cells or columns to the specified value. Word preserves the width of all non-selected columns, shifting them to the right or left as necessary. This is the default value.
wdAdjustProportional Sets the width of the cells in the first column only to the specified value. If multiple columns are selected, Word preserves the right edge of the table and the positions of the non-selected columns by proportionally adjusting the width of the other selected columns. If only one cell or column is selected, Word preserves the right edge of the table by proportionally adjusting the width of the other cells or columns.
wdAdjustSameWidth Sets the width of the cells in the first column only to the specified value. Word preserves the right edge of the table by adjusting the width of all other cells or columns to the same value.

Remarks

The WdRulerStyle behavior described above applies to left-aligned tables. The WdRulerStyle behavior for center- and right-aligned tables can be unexpected; in these cases, the SetWidth method should be used with care.