activeElement Property

       

Returns an IHTMLElement object that represents the active element in the current document.

expression.activeElement

expression   Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example returns the active element of the current document and displays the element's associated class name. If the className property is empty, a message is displayed to the user instead.

Sub ReturnActiveElement()
'Returns the active element of the current document
'and displays the element's class name.

    Dim objApp As FrontPage.Application
    Dim objElement As IHTMLElement

    Set objApp = FrontPage.Application
    Set objElement = objApp.ActiveDocument.activeElement

    'If the classname is not empty then
    If objElement.className <> "" Then
        'Display class name to user
        MsgBox "The current element is a " & _
               objElement.className & "."
    Else
       'Otherwise display message
       MsgBox "The current element has no associated class name."
    End If

End Sub