Borders.DistanceFrom procedure builder

Borders.DistanceFrom (Word)

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.

wdBorderDistanceFromPageEdge - From the edge of the page, wdBorderDistanceFromText - From the text it surrounds.
Dim borderLoop As Border 
 
With ActiveDocument.Sections(1) 
 For Each borderLoop In .Borders 
 borderLoop.LineStyle = wdLineStyleSingle 
 borderLoop.LineWidth = wdLineWidth050pt 
 Next borderLoop 
 With .Borders 
 .DistanceFrom = wdBorderDistanceFromPageEdge 
 .DistanceFromTop = 20 
 .DistanceFromLeft = 22 
 .DistanceFromBottom = 20 
 .DistanceFromRight = 22 
 End With 
End With