Height Property

Microsoft Word Visual Basic

Show All

Height Property

       

Returns or sets the height of the specified object (in points unless otherwise noted), as shown in the following table.

Object Height
Application Returns or sets the height of the active document window. Read/write Long.
Cell, Cells Returns or sets the height of the specified cell or cells in a table. If the HeightRule property of the specified row is wdRowHeightAuto, Height returns wdUndefined; setting the Height property sets HeightRule to wdRowHeightAtLeast. Read/write Single.
CustomLabel Returns or sets the height of the specified custom mailing label. Read/write Single.
Frame Returns or sets the height of the specified frame. Read/write Single.
Frameset Returns or sets the height of the specified Frameset object. Read/write Float. The HeightType property determines the type of unit in which this value is expressed.
InlineShape Returns or sets the height of the specified inline shape. Read/write Single.
Row, Rows Returns or sets the height of the specified row or rows in a table. If the HeightRule property of the specified row is wdRowHeightAuto, Height returns wdUndefined; setting the Height property sets HeightRule to wdRowHeightAtLeast. Read/write Single.
Shape, ShapeRange Returns or sets the height of the specified shape. Read/write Single.
Task Returns or sets the height of the specified task window. Read/write Long.
Window Returns or sets the height of the window. You cannot set this property if the window is maximized or minimized. Use the UsableHeight property of the Application object to determine the maximum size for the window. Use the WindowState property to determine the window state. Read/write Long.

Example

As it applies to the Rows object.

This example sets the height of the rows in the first table in the active document to at least 20 points.

ActiveDocument.Tables(1).Rows.Height = 20

As it applies to the Row object.

This example displays the height (in points) of the table row that contains the insertion point.

If Selection.Information(wdWithInTable) = True Then
    MsgBox Selection.Rows(1).Height
End If

As it applies to the Window object.

This example changes the height of the active window to fill the application window area.

With ActiveDocument.ActiveWindow
    .WindowState = wdWindowStateNormal
    .Height = Application.UsableHeight
End With

As it applies to the ShapeRange object.

This example inserts a picture as an inline shape and changes the height and width of the image.

Set aInLine = _
    ActiveDocument.InlineShapes.AddPicture( _
    FileName:="C:\Windows\Bubbles.bmp", _
    Range:=Selection.Range)
With aInLine
    .Height = 100
    .Width = 200
End With

As it applies to the Frameset object.

This example sets the height of the specified Frameset object to 25% of the window height.

With ActiveWindow.ActivePane.Frameset
    .HeightType = wdFramesetSizeTypePercent
    .Height = 25
End With