HeightRule Property

Applies To

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

Description

Cell, Cells, Row, and Rows objects: Returns or sets the rule for determining the height of the specified cells or rows. Can be one of the following WdRowHeightRule constants: wdRowHeightAtLeast, wdRowHeightAuto, or wdRowHeightExactly. Read/write Long.

Frame object: Returns or sets the rule for determining the height of the specified frame. Can be one of the following WdFrameSizeRule constants: wdFrameAtLeast, wdFrameAuto, or wdFrameExact. Read/write Long.

Remarks

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

See Also

AutoFit method, DistributeHeight method, HeadingFormat property, Height property, Rows property, SetHeight method, Width property, WidthRule property.

Example

This example creates a 3x3 table in a new document and then sets a minimum row height of 24 points for the second row.

Set newDoc = Documents.Add
Set myTable = newDoc.Tables.Add(Range:=Selection.Range, NumRows:=3, _
    NumColumns:=3)
With myTable.Rows(2)
    .Height = 24
    .HeightRule = wdRowHeightAtLeast
End With
This example sets the height rule for the selected rows to automatically adjust to the tallest cell in the row.

If Selection.Information(wdWithInTable) = True Then
    Selection.Rows.HeightRule = wdRowHeightAuto
Else
    MsgBox "The insertion point is not in a table."
End If
This example sets both the height and width of the first frame in the active document to exactly 1 inch.

If ActiveDocument.Frames.Count >= 1 Then
    With ActiveDocument.Frames(1)
        .HeightRule = wdFrameExact
        .Height = InchesToPoints(1)
        .WidthRule = wdFrameExact
        .Width = InchesToPoints(1)
    End With
End If