VerticalPosition Property

Microsoft Word Visual Basic

object) or the rows (for the Rows object) and the item specified by the RelativeVerticalPosition property. Can be a number that indicates a measurement in points, or can be any valid WdFramePosition constant. For a list of valid constants, consult the Microsoft Visual Basic Object Browser. Read/write Single.

expression.VerticalPosition

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

This example vertically aligns the first frame in the active document with the top of the page.

Set myFrame = ActiveDocument.Frames(1)
With myFrame
    .RelativeVerticalPosition = wdRelativeVerticalPositionPage
    .VerticalPosition = wdFrameTop
End With
		

This example adds a frame around the first shape in the active document and positions the frame 1 inch from the top margin.

If ActiveDocument.Shapes.Count >= 1 Then
    ActiveDocument.Shapes(1).Select
    Set aFrame = ActiveDocument.Frames.Add(Range:=Selection.Range)
    With aFrame
        .RelativeVerticalPosition = _
            wdRelativeVerticalPositionMargin
        .VerticalPosition = InchesToPoints(1)
    End With
End If
		

This example vertically aligns the first table in the active document with the top of the page.

Set myTable = ActiveDocument.Tables(1).Rows
With myTable
    .RelativeVerticalPosition = wdRelativeVerticalPositionPage
    .VerticalPosition = wdTableTop
End With