Muokkaa

Jaa


Border object (Word)

Represents a border of an object. The Border object is a member of the Borders collection.

Remarks

Use Borders (index), where index identifies the border, to return a single Border object. Index can be one of the WdBorderType constants. Some of the WdBorderType constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

Use the LineStyle property to apply a border line to a Border object. The following example applies a double-line border below the first paragraph in the active document.

With ActiveDocument.Paragraphs(1).Borders(wdBorderBottom) 
 .LineStyle = wdLineStyleDouble 
 .LineWidth = wdLineWidth025pt 
End With

The following example applies a single-line border around the first character in the selection.

With Selection.Characters(1) 
 .Font.Size = 36 
 .Borders.Enable = True 
End With

The following example adds an art border around each page in the first section.

For Each aBorder In ActiveDocument.Sections(1).Borders 
 With aBorder 
 .ArtStyle = wdArtSeattle 
 .ArtWidth = 20 
 End With 
Next aBorder

Border objects cannot be added to the Borders collection. The number of members in the Borders collection is finite and varies depending on the type of object. For example, a table has six elements in the Borders collection, whereas a paragraph has four.

Properties

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.