Hi Guys,
I am new to the world of Macro's, and trying to learn a bit. I was in search of a macro that will;
- "see" my open IE that is busy with loading my batch.
- "message" me when the website is done with loading.
So far I am receiving an error on "If TypeName(oWin.Document) = "HTMLDocument" Then"
Error 2147467259 (80004005) - Method Document of object Iwebbrowser2 failed
I hope you guys can help me out with this one!
Thanks!
What I have so far;
Public Declare Function ShowWindow& Lib "user32" ( _
ByVal hwnd As Long, _
ByVal nCmdShow As Long)
Sub LoopIeInstances()
Dim oShApp As Object, oWin As Object, IE As Object
Dim WScript As Object
Set oShApp = CreateObject("Shell.Application")
For Each oWin In oShApp.Windows
If TypeName(oWin.Document.Title) = "HTMLDocument" Then
Set IE = oWin
Exit For
End If
Next
If IE Is Nothing Then _
Set IE = CreateObject("InternetExplorer.Application")
With IE
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
IE.Visible = True
' Clean up
Set IE = Nothing
Set objElement = Nothing
Set objCollection = Nothing
Application.StatusBar = ""
End With
Set IE = Nothing: Set oShApp = Nothing
End Sub
Bookmarks