Class HTMLDivisions (Word VBA)

A collection of HTMLDivision objects that represents the HTML DIV elements that exist in a web document. To use a HTMLDivisions class variable it first needs to be instantiated, for example


Dim htms as HTMLDivisions
Set htms = ActiveDocument.Range.HTMLDivisions

For Each

Here is an example of processing the HTMLDivisions items in a collection.


Dim htm As HTMLDivision
For Each htm In ActiveDocument.Range.HTMLDivisions
	
Next htm

Add

Returns an HTMLDivision object that represents a new HTML division added to a web document.

Add (Range)

Range: An existing HTML division around which to place the new HTML division.


Dim htm As HTMLDivision
Set htm = ActiveDocument.Range.HTMLDivisions.Add()

Count

Returns a Long that represents the number of HTML DIV elements in the collection.


Dim lngCount As Long
lngCount = ActiveDocument.Range.HTMLDivisions.Count

Item

Returns an individual HTMLDivision object in a collection.

Item (Index)

Index: The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.


Dim htm As HTMLDivision
Set htm = ActiveDocument.Range.HTMLDivisions(Index:=1)

NestingLevel

Returns the nesting level of the specified HTML DIV elements.


Dim lngNestingLevel As Long
lngNestingLevel = ActiveDocument.Range.HTMLDivisions.NestingLevel