IHTMLElementCollection Collection

Microsoft FrontPage Visual Basic

IHTMLElementCollection Collection

Multiple objects IHTMLElementCollection

Represents a collection of elements in an HTML document.

Using the IHTMLElementCollection collection

Use the all property of the FPHTMLDocument or IHTMLDocument2 object to return a collection of all elements in a document, including elements in the HEAD element. The following example accesses all elements in the active document.

    Dim objElements As IHTMLElementCollection

Set objElements = ActiveDocument.all
  

Use the all property of the FPHTMLBody or IHTMLBodyElement object to return a collection of all elements in the BODY element of a document. The following example accesses all elements in the body of active document.

    Dim objElements As IHTMLElementCollection

Set objElements = ActiveDocument.body.all
  

Use the tags method to return a collection of a specific elements. The following example accesses all P elements in the active document.

    Dim objParagraphs As IHTMLElementCollection

Set objParagraphs = ActiveDocument.body.all.tags("p")