Dim WithEvents m_objDoc As HTMLDocumentPrivate Sub Form_Load() Me.WebBrowser1.Navigate2 "网页地址" End SubPrivate Function m_objDoc_onclick() As Boolean If m_objDoc.activeElement.tagName = "A" Then Me.Text1 = m_objDoc.activeElement.Id End If End FunctionPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant) Set m_objDoc = Me.WebBrowser1.Document End Sub
Dim WithEvents m_objDoc As HTMLDocumentPrivate Sub Form_Load()
Me.WebBrowser1.Navigate2 "网页地址"
End SubPrivate Function m_objDoc_onclick() As Boolean
If m_objDoc.activeElement.tagName = "A" Then
Me.Text1 = m_objDoc.activeElement.Id
End If
End FunctionPrivate Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Set m_objDoc = Me.WebBrowser1.Document
End Sub