HTMLDivisions プロパティ

Microsoft Word Visual Basic リファレンス

HTMLDivisions プロパティ

Web 文書内の HTML 部分を表す HTMLDivisions オブジェクトを取得します。

expression.HTMLDivisions

*expression *  必ず指定します。対象となるオブジェクトへの参照を表すオブジェクト式を指定します。

使用例

次の使用例は、現在の文書内の 3 つの入れ子部分に書式を設定します。この使用例では、現在の文書は少なくとも 3 つの部分を持つ HTML 文書であることを前提としています。

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

End Sub