Internet Explorer ActiveX Control - .busy property doesn't work in do loop.
Posted on 2003-02-25
This problem won't go away.
I'm using a Microsoft Web Browser control embedded into a Excel VBA Userform. I'm writing a script which will automate form entry on an intranet site and proceed through each page.
The lines of code I keep finding when looking for ways to 'wait' for the page to load are as follows.
Do Until webbrowser1.ReadyState = READYSTATE_COMPLETE
Do until webbrowser1.busy = false
Neither of these work. With the first example, the script hangs. It seems that the do loop, despite the do events, doesn't give the control enough 'breathing space' to actually load the page. In the second example, .busy seems to return false even while nested frames are still loading. The next line in the program then fires, (referencing a form variable which isn't there yet) causing it to drop an error message. Even once I've figured this out I need to get some detection for timeouts.
Has anyone else had any problems, specifically when using Excel VBA or does anyone know what I might try next?