I'm using a gobal mouse hook, whenever there is mouse click, CaptureData () method will be called. The problem comes when i try to do something to the objIE1, i get a Runtime error '-2147417843(8001010d)' Automation Error. What did i do wrong?


Public Sub CaptureData()
Set objShellWins = New SHDocVw.ShellWindows

On Error GoTo cap

Dim objIE1 As SHDocVw.InternetExplorer


If isForegroundIE = True Then
Debug.Print "Current is IE"

For Each objIE1 In objshellwindows
'this is the code that gives mi error
Debug.Print objIE1.hwnd

Next objIE1

Exit Sub
cap:
Debug.Print Err.Number & " " & Err.Description
End If
End Sub