Share via


Borders.DistanceFromRight Property (Word)

Returns or sets the space (in points) between the right edge of the text and the right border. Read/write Long.

Syntax

expression .DistanceFromRight

expression A variable that represents a Borders object.

Remarks

Using this property with a page border, you can set either the space between the text and the right border or the space between the right edge of the page and the right border. Where the distance is measured from depends on the value of the DistanceFrom property.

Example

This example adds a border around each paragraph in the selection and sets the distance between the text and the right border to 3 points.

With Selection.Paragraphs.Borders 
 .Enable = True 
 .DistanceFromRight = 3 
End With

This example adds a single border around each page in section one in the active document. The example also sets the distance between the right and left border and the corresponding edges of the page to 22 points.

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 
 .DistanceFromLeft = 22 
 .DistanceFromRight = 22 
 End With 
End With

See Also

Concepts

Borders Collection Object

Borders Object Members