HTMLDivisions 物件 (Word)

代表 Web 文件中存在之 HTML DIV 元素的 HTMLDivision 物件集合。

註解

使用 HTMLDivisions 屬性傳回 HTMLDivisions 集合。 使用 Add 方法在網頁文件中新增 HTML 分割。 這個範例會在使用中文件內新增 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 支援與意見反應