IHTMLDocument2 Object

Microsoft FrontPage Visual Basic

IHTMLDocument2 Object

Multiple objects IHTMLDocument2
Multiple objects

Represents the active HTML document. The IHTMLDocument2 object contains property information related to the HTML in a Web page such as background color, link color, and style sheet as well as methods that act on the data such as the CreateElement and ExecCommand methods.

The IHTMLDocument2 object provides access to a limited number of properties and methods that relate to a Web page. For access to all properties and methods, use the FPHTMLDocument object.

Using the IHTMLDocument2 object

Use the ActiveDocument property of the Application object or the Document property of the PageWindowEx object to return an IHTMLDocument2 object. The following example accesses the active document by using the ActivePageWindow property.

    Dim objDoc As IHTMLDocument2

Set objDoc = ActivePageWindow.Document
  

The following example accesses the active document by using the ActiveDocument property.

    Dim objDoc As IHTMLDocument2

Set objDoc = ActiveDocument
  

Note  There is no way to access the contents of a Web page using Visual Basic for Applications (VBA) in Microsoft FrontPage without first opening the document and setting it as the active document using either the ActivePageWindow property, as shown in the preceding example, or the ActiveDocument property.

Remarks

The PageWindowEx object, in the FrontPage Web Object Model, contains both an ActiveDocument property and a Document property. Both properties return an IHTMLDocument2 object. However, when a FRAMESET element is contained within a page, the Document property returns the page containing the FRAMESET element, and the ActiveDocument property returns the page referenced in the SRC attribute of the FRAME element located at the current insertion point position.