HtmlDivisions 对象 (Word)

HTMLDivision 对象的集合,这些对象表示 Web 文档中存在的 HTML DIV 元素。

备注

使用 HTMLDivisions 属性可返回 HTMLDivisions 集合。 使用 Add 方法将 HTML 除法添加到 Web 文档。 以下示例将一个新的 HTML 划分添加到活动文档,在该划分中添加文字,并设置该划分周围边框的格式。

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

另请参阅

Word 对象模型参考

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。