HTMLEditor Property Example

The following VBScript example uses the Click event of a CommandButton named "CommandButton1" to demonstrate the listing of all HTML elements.

Sub CommandButton1_Click()
    Dim i         'As Integer
    Dim strHTMLType    'As String
    Dim strHTMLText    'As String
    Dim NL        'As String

    NL = chr(10) & chr(13)

    Set myInspector = Item.GetInspector
    Set myIExplorer = myInspector.HTMLEditor
    If myIExplorer.ReadyState <> "complete" Then  
'Test for complete loading of HTML doc
        For i = 0 To myIExplorer.All.Length - 1
            strHTMLType = TypeName(myIExplorer.All.Item(i))
            On Error Resume Next
'because not all elements support OuterHTML
            strHTMLText = ": " & NL &     myIExplorer.All.Item(i).outerHTML
            On Error GoTo 0
            MsgBox strHTMLType & strHTMLText
            strHTMLText = ""
        Next
    End If
End Sub