SetHeight Method

Applies To

Cell object, Cells collection object, Row object, Rows collection object.

Description

Sets the height of table rows or cells.

Syntax

expression.SetHeight(RowHeight, HeightRule)

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

RowHeight Required Single. The height of the row or rows, in points.

HeightRule Optional Variant. The rule for determining the height of the specified cells. Can be one of the following WdRowHeightRule constants: wdRowHeightAtLeast, wdRowHeightAuto, or wdRowHeightExactly. The default value is wdRowHeightAtLeast.

Remarks

Setting the SetHeight property of a Cell or Cells object automatically sets the property for the entire row.

See Also

AutoFormat method, DistributeHeight method, Height property, HeightRule property, SetWidth method.

Example

This example creates a table and then sets a fixed row height of 0.5 inch (36 points) for the first row.

Set newDoc = Documents.Add
Set aTable = newDoc.Tables.Add(Range:=Selection.Range, NumRows:=3, _
    NumColumns:=3)
aTable.Rows(1).SetHeight RowHeight:=InchesToPoints(0.5), _
    HeightRule:=wdRowHeightExactly
This example sets the row height of the selected cells to at least 18 points.

If Selection.Information(wdWithInTable) = True Then
    Selection.Cells.SetHeight RowHeight:=18, HeightRule:=wdRowHeightAtLeast
Else
    MsgBox "The insertion point is not in a table."
End If