You need to have "HTML Object Library" in the References window, and a webbrowser control (Microsoft Internet Controls). Once you've inserted this code into your project, you'll notice a new object in the Code window called mdocDocument. It has lots of events, such as: Click
, Double Click
, Mouse Move
, KeyUp
, KeyDown
and lots more...
Place the following code in the General Declarations section
Private mhtmDoc3 As IHTMLDocument3
Private WithEvents mdocDocument As HTMLDocument
' When navigating to a new page, update the Object we're monitoring
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
Set mhtmDoc3 = WebBrowser1.Document
Set mdocDocument = mhtmDoc3
End Sub
Comments