SetHeight Method

Microsoft Word Visual Basic

Show All

SetHeight Method

       

SetHeight method as it applies to the Row and Rows objects.

Sets the height of table rows.

expression.SetHeight(RowHeight, HeightRule)

expression   Required. An expression that returns one of the above objects.

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

HeightRule  Required WdRowHeightRule. The rule for determining the height of the specified rows.

WdRowHeightRule can be one of these WdRowHeightRule constants.
wdRowHeightAtLeast
wdRowHeightExactly
wdRowHeightAuto

 

SetHeight method as it applies to the Cell and Cells objects.

Sets the height of table cells.

expression.SetHeight(RowHeight, HeightRule)

expression   Required. An expression that returns one of the above objects.

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

HeightRule  Required WdRowHeightRule. The rule for determining the height of the specified cells.

WdRowHeightRule can be one of these WdRowHeightRule constants.
wdRowHeightAtLeast
wdRowHeightExactly
wdRowHeightAuto

 

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

Example

As it applies to the Rows object.

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

As it applies to the Cells object.

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