HTMLDivisions object (Word)

A collection of HTMLDivision objects that represents the HTML DIV elements that exist in a web document.

Remarks

Use the HTMLDivisions property to return the HTMLDivisions collection. Use the Add method to add an HTML division to a web document. This example adds a new HTML division to the active document, adds text to the division, and formats the borders around the division.

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

See also

Word Object Model Reference

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.