DistanceTop Property

Microsoft Word Visual Basic

DistanceTop Property

       

Rows object: Returns or sets the distance (in points) between the document text and the top edge of the specified table. This property doesn't have any effect if WrapAroundText is False. Read/write Single.

WrapFormat object: Returns or sets the distance (in points) between the document text and the top edge of the text-free area surrounding the specified shape. The size and shape of the specified shape, together with the values of the Type and Side properties of the WrapFormat object, determine the size and shape of this text-free area. Read/write Single.

Example

This example sets text to wrap around the first table in the active document and sets the distance for wrapped text to 20 points on all sides of the table.

With ActiveDocument.Tables(1).Rows
    .WrapAroundText = True
    .DistanceLeft = 20
    .DistanceRight = 20
    .DistanceTop = 20
    .DistanceBottom = 20
End With

This example adds an oval to the active document and specifies that the document text wrap around the left and right sides of the square that circumscribes the oval. The example sets a 0.1-inch margin between the document text and the top, bottom, left side, and right side of the square.

Dim shapeOval As Shape

Set shapeOval = ActiveDocument.Shapes.AddShape(msoShapeOval, _
    0, 0, 200, 50)
With shapeOval.WrapFormat
    .Type = wdWrapSquare
    .Side = wdWrapBoth
    .DistanceTop = InchesToPoints(0.1)
    .DistanceBottom = InchesToPoints(0.1)
    .DistanceLeft = InchesToPoints(0.1)
    .DistanceRight = InchesToPoints(0.1)
End With