SimpleArts
10-29-2011, 11:00 AM
I'm having issues with any and all of my scripts in general that have IE automation included in them. My internet connection will occasionally timeout and stop responding for anywhere from 5 to 60 seconds. This causes my scripts to go into an infinite loop. When this happens the instance of IE will go blank white across the screen as usual and it will just hang there forever until I escape out of it.
My question is...
Is there any changes I could make that would allow the script to occasionally try and refresh the IE instance if nothing is happening or perhaps if the elements it's looking for aren't present, or in any way get past a temporarily unresponsive connection.
Here is my general code for creating the IE instance.
Any help would be much appreciated!
Set ObjIE = CreateObject("InternetExplorer.Application")
With ObjIE
.AddressBar = False
.StatusBar = False
.MenuBar = False
.Toolbar = 0
.Visible = True
End With
sURL = "URL Goes Here"
ObjIE.navigate sURL
While ObjIE.Busy
Wend
While ObjIE.document.ReadyState <> "complete"
Wend
'Buffer time
Application.Wait Now + TimeValue("00:00:03")
'Wait time creates buffer.
'Buffer allows extra time for everything to on page to load
'because when IE says it's ready, 9 times out of 10, its not.
'It needs a few extra seconds for elements to become present
My question is...
Is there any changes I could make that would allow the script to occasionally try and refresh the IE instance if nothing is happening or perhaps if the elements it's looking for aren't present, or in any way get past a temporarily unresponsive connection.
Here is my general code for creating the IE instance.
Any help would be much appreciated!
Set ObjIE = CreateObject("InternetExplorer.Application")
With ObjIE
.AddressBar = False
.StatusBar = False
.MenuBar = False
.Toolbar = 0
.Visible = True
End With
sURL = "URL Goes Here"
ObjIE.navigate sURL
While ObjIE.Busy
Wend
While ObjIE.document.ReadyState <> "complete"
Wend
'Buffer time
Application.Wait Now + TimeValue("00:00:03")
'Wait time creates buffer.
'Buffer allows extra time for everything to on page to load
'because when IE says it's ready, 9 times out of 10, its not.
'It needs a few extra seconds for elements to become present