Word VBA教程:HTMLDivisions属性

该属性返回一个HTMLDivisions对象,该对象代表 Web 文档中的一个 HTML 区域。

expression.HTMLDivisions

expression   必需。该表达式返回“应用于”列表中的一个对象。

VBA示例

本示例设置活动文档中三个嵌套的区域的格式。本示例假定该活动文档为具有至少三个区域的 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

Word VBA教程

Word VBA参考教程:目录1 Word VBA参考教程:目录2
Word VBA参考教程:目录3 Word VBA参考教程:目录4
Word VBA参考教程:目录5 Word VBA参考教程:目录6
Word VBA参考教程:目录7 Word VBA参考教程:目录8
Word VBA参考教程:目录9 Word VBA参考教程:目录10
版权所有 © 中山市飞娥软件工作室 证书:粤ICP备09170368号