I am using :
While ie.busy
DoEvents
Wend
' Some Code
To add a pause in my code, while internet explorer refreshes. But this doesnt seem to be working well. The 'Some code part is getting executed pre-maturely and throwing an error.
I have tried using other methods as well. for e.g.
Errorhandler:
While ie.busy
DoEvents
Wend
On Error Goto Errorhandler
'Some Code
But even this isnt working and sometimes the code is esecuted pre maturely.
Please suggest an infallible alternative to ie.busy
In our code, ie.Busy (InternetExplorer.Application Object) is not very credible. Here is what we use and works:
Enum READYSTATE
READYSTATE_UNINITIALIZED = 0
READYSTATE_LOADING = 1
READYSTATE_LOADED = 2
READYSTATE_INTERACTIVE = 3
READYSTATE_COMPLETE = 4
End Enum
Dim strUrl
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
'....
' do navigation...
'
strUrl = "http://www.example.com/"
ie.Navigate strUrl
'
' waiting for the ie complete loading:
'
Do While (ie.Busy Or ie.READYSTATE <> READYSTATE.READYSTATE_COMPLETE)
DoEvents
Loop
'
' here below you do stuffs on the new loaded URL:
'
You can try.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With