DistanceFrom Property
Applies To
Borders collection object.
Description
Returns or sets a value that indicates whether the specified page border is measured from the edge of the page or from the text it surrounds. Can be either of the following WdBorderDistanceFrom constants: wdBorderDistanceFromPageEdge or wdBorderDistanceFromText. Read/write Long.
See Also
DistanceFromBottom property, DistanceFromLeft property, DistanceFromRight property, DistanceFromTop property, JoinBorders property, SurroundFooter property, SurroundHeader 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