HTMLDivisions Collection

HTMLDivisions Collection
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.


Aa662257.parchild(en-us,office.10).gifHTMLDivisions
Aa662257.space(en-us,office.10).gifAa662257.parchild(en-us,office.10).gifHTMLDivision

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
        .Add
        .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