HTMLDivisions Collection

Multiple objects
Multiple objects

A collection of HTMLDivision objects that represents the HTML divisions that exist in a Web document.

Using the HTMLDivisions collection

Use the HTMLDivisions property to return the HTMLDivisions collection. Use the Add method to add an HTML division to a Web document. This example adds a new HTML division to the active document, adds text to the division, and formats the borders around the division.

Sub NewDivision()

    With ActiveDocument.HTMLDivisions
        .Item(Index:=1).Range.Text = "This is a new HTML division."
        With .Item(1)
            With .Borders(wdBorderBottom)
                .LineStyle = wdLineStyleTriple
                .LineWidth = wdLineWidth025pt
                .Color = wdColorRed
            End With
            With .Borders(wdBorderTop)
                .LineStyle = wdLineStyleDot
                .LineWidth = wdLineWidth050pt
                .Color = wdColorBlue
            End With
            With .Borders(wdBorderLeft)
                .LineStyle = wdLineStyleDouble
                .LineWidth = wdLineWidth075pt
                .Color = wdColorBrightGreen
            End With
            With .Borders(wdBorderRight)
                .LineStyle = wdLineStyleDashDotDot
                .LineWidth = wdLineWidth075pt
                .Color = wdColorTurquoise
            End With
        End With
    End With

End Sub

Properties | Application Property | Count Property | Creator Property | NestingLevel Property | Parent Property

Methods | Add Method | Item Method

Parent Objects | Document | HTMLDivision | Range | Selection

Child Objects | Borders | HTMLDivisions | Range