Borders Collection Object

Multiple objects

A collection of Border objects that represent the borders of an object.

Using the Borders Collection

Use the Borders property to return the Borders collection. The following example applies the default border around the first paragraph in the active document.

ActiveDocument.Paragraphs(1).Borders.Enable = True

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.

Use Borders(index), where index identifies the border, to return a single Border object. Index can be one of the following WdBorderType constants: wdBorderBottom, wdBorderDiagonalDown, wdBorderDiagonalUp, wdBorderHorizontal, wdBorderLeft, wdBorderRight, wdBorderTop, or wdBorderVertical. Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you've 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

Properties | AlwaysInFront Property | Application Property | Count Property | Creator Property | DistanceFrom Property | DistanceFromBottom Property | DistanceFromLeft Property | DistanceFromRight Property | DistanceFromTop Property | Enable Property | EnableFirstPageInSection Property | EnableOtherPagesInSection Property | HasHorizontal Property | HasVertical Property | InsideColor Property | InsideColorIndex Property | InsideLineStyle Property | InsideLineWidth Property | JoinBorders Property | OutsideColor Property | OutsideColorIndex Property | OutsideLineStyle Property | OutsideLineWidth Property | Parent Property | Shadow Property | SurroundFooter Property | SurroundHeader Property

Methods | ApplyPageBordersToAllSections Method | Item Method

Parent Objects | Cell | Cells | Column | Columns | ConditionalStyle | Font | Frame | HTMLDivision | InlineShape | Paragraph | ParagraphFormat | Paragraphs | Range | Row | Rows | Section | Selection | Style | Table | TableStyle

Child Objects

See Also | Shading Object