HTMLDivisionParent Method

Microsoft Word Visual Basic

object that represents a parent division of the current HTML division.

expression.HTMLDivisionParent(LevelsUp)

expression    Required. An expression that returns one of the objects in the Applies To list.

LevelsUp   Optional Long. The number of parent divisions to count back to return the desired division. If the LevelsUp argument is omitted, the HTML division returned is one level up from the current HTML division.

Example

This example formats the borders for two HTML divisions in the active document. This example assumes that the active document is an HTML document with at least two divisions.

Sub FormatHTMLDivisions()
    With ActiveDocument.HTMLDivisions(1)
        With .HTMLDivisions(1)
            .LeftIndent = InchesToPoints(1)
            .RightIndent = InchesToPoints(1)
            With .Borders(wdBorderLeft)
                .Color = wdColorBlue
                .LineStyle = wdLineStyleDouble
            End With
            With .Borders(wdBorderRight)
                .Color = wdColorBlue
                .LineStyle = wdLineStyleDouble
            End With
            With .HTMLDivisionParent
                .LeftIndent = InchesToPoints(1)
                .RightIndent = InchesToPoints(1)
                With .Borders(wdBorderTop)
                    .Color = wdColorBlack
                    .LineStyle = wdLineStyleDot
                End With
                With .Borders(wdBorderBottom)
                    .Color = wdColorBlack
                    .LineStyle = wdLineStyleDot
                End With
            End With
        End With
    End With
End Sub