Share via


HeightRule Property

HeightRule property as it applies to the Frame object.

WdFrameSizeRule

WdFrameSizeRule can be one of these WdFrameSizeRule constants.
wdFrameAtLeast
wdFrameExact
wdFrameAuto

expression.HeightRule

expression Required. An expression that returns a Frame object.

HeightRule property as it applies to the Cell, Cells, Row, and Rows objects.

WdRowHeightRule

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

expression.HeightRule

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

Remarks

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

Example

As it applies to the Frame object.

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

As it applies to the Row object.

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

As it applies to the Rows object.

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

Applies to | Cell Object | Cells Collection Object | Frame Object | Row Object | Rows Collection Object

See Also | AutoFit Method | DistributeHeight Method | HeadingFormat Property | Height Property | Rows Property | SetHeight Method | Width Property | WidthRule Property