Top Property

Microsoft Word Visual Basic

Show All

Top Property

       

Top property as it applies to the Shape and ShapeRange objects.

Returns or sets the vertical position of the specified shape or shape range in points. Read/write Single.

expression.Top

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

Remarks

The position of a shape is measured from the upper-left corner of the shape's bounding box to the shape's anchor. The RelativeVerticalPosition property controls whether the shape's anchor is positioned alongside the line, the paragraph, the margin, or the edge of the page.

For a ShapeRange object that contains more than one shape, the Top property sets the vertical position of each shape.

Top property as it applies to the Application, Task, and Window objects.

Returns or sets the vertical position of the active document (for the Application object) or the specified task or window, in points. Read/write Long.

expression.Top

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

Example

As it applies to the Application object.

This example positions the Word application window 100 points from the top of the screen.

Application.WindowState = wdWindowStateNormal
Application.Top = 100

As it applies to the Shape object.

This example sets the vertical position of the first shape in the active document to 1 inch from the top of the page.

With ActiveDocument.Shapes(1)
    .RelativeVerticalPosition = wdRelativeVerticalPositionPage
    .Top = InchesToPoints(1)
End With

This example sets the vertical position of the first and second shapes in the active document to 1 inch from the top of the page.

With ActiveDocument.Shapes.Range(Array(1, 2))
    .RelativeVerticalPosition = wdRelativeVerticalPositionPage
    .Top = InchesToPoints(1)
End With

As it applies to the Task object.

This example starts the Calculator and positions its window 100 points from the top of the screen.

Shell "Calc.exe"
With Tasks("Calculator")
    .WindowState = wdWindowStateNormal
    .Top = 100
End With