ApplyPageBordersToAllSections Method

Microsoft Word Visual Basic

ApplyPageBordersToAllSections Method

       

Applies the specified page-border formatting to all sections in a document.

expression.ApplyPageBordersToAllSections

expression   Required. An expression that returns a Borders object.

Example

This example adds a single-line page border to all sections in the active document.

Dim borderLoop As Border

With ActiveDocument.Sections(1)
    For Each borderLoop In .Borders
        With borderLoop
            .LineStyle = wdLineStyleSingle
            .LineWidth = wdLineWidth050pt
        End With
    Next borderLoop
    .Borders.ApplyPageBordersToAllSections
End With