HorizontalPosition Property

Microsoft Word Visual Basic

Frame object: Returns or sets the horizontal distance between the edge of the frame and the item specified by the RelativeHorizontalPosition property. Can be a number that indicates a measurement in points, or can be one of the following WdFramePosition constants: wdFrameLeft, wdFrameRight, wdFrameCenter, wdFrameInside, or wdFrameOutside. Read/write Single.

Rows object: Returns or sets the horizontal distance between the edge of the rows and the item specified by the RelativeHorizontalPosition property. Can be a number that indicates a measurement in points, or can be one of the following WdTablePosition constants: wdTableLeft, wdTableRight, wdTableCenter, wdTableInside, or wdTableOutside. Read/write Single. This property doesn't have any effect if WrapAroundText is False.

Example

This example aligns the first frame in the active document horizontally with the right margin.

If ActiveDocument.Frames.Count >= 1 Then
    With ActiveDocument.Frames(1)
        .RelativeHorizontalPosition = _
            wdRelativeHorizontalPositionMargin
        .HorizontalPosition = wdFrameRight
    End With
End If
		

This example aligns the first table in the active document horizontally with the right margin.

If ActiveDocument.Tables.Count >= 1 Then
    With ActiveDocument.Tables(1).Rows
        .RelativeHorizontalPosition = _
            wdRelativeHorizontalPositionMargin
        .HorizontalPosition = wdTableRight
    End With
End If