DistanceFrom Property Example

This example adds a single border around each page in section one in the active document and then sets the distance between each border and the corresponding edge of the page.

With ActiveDocument.Sections(1)
    For Each aBord In .Borders
        aBord.LineStyle = wdLineStyleSingle
        aBord.LineWidth = wdLineWidth050pt
    Next aBord
    With .Borders
        .DistanceFrom = wdBorderDistanceFromPageEdge
        .DistanceFromTop = 20
        .DistanceFromLeft = 22
        .DistanceFromBottom = 20
        .DistanceFromRight = 22
    End With
End With

This example adds a border around each page in the first section in the selection, and then it sets the distance between the text and the page border to 6 points.

With Selection.Sections(1)
    For Each aBorder In .Borders
        aBorder.ArtStyle = wdArtSeattle
        aBorder.ArtWidth = 22
    Next aBorder
    With .Borders
        .DistanceFrom = wdBorderDistanceFromText
        .DistanceFromTop = 6
        .DistanceFromLeft = 6
        .DistanceFromBottom = 6
        .DistanceFromRight = 6
    End With
End With