VBA Web Browser

ASherbuck

Registered User.
Local time
Today, 09:53
Joined
Feb 25, 2008
Messages
194
Hello,
I'm experimenting with a web browser on my form and I had thought that the following code:

Do While Me.Browser.Busy
DoEvents
Loop

Would basically make the code wait until the browser had finished loading to continue. Unfortunately it isn't true.

Right now I'm running with a manual throttle with:
Throttle = txtThrottle
Wait = Timer
While Timer < Wait + Throttle
DoEvents
Wend

So a user can specify on the form that they want to wait 1, 2, 3, etc seconds for the pages to load. Of course this is pretty inneffective as a safe number is usually too long and a low number is inconsistent.

Anyone know of a possible solution?
 
After a long time banging my head off the keyboard the answer diffused into my skull!

I am using
Wait = Timer
While Timer < Wait + 2
DoEvents
Wend

Do Until Browser.Busy = False
DoEvents
Loop

and it is working very well. I have 6 different text boxes on my form and the activex browser navigates 6 pages through a loop. So I put the 2 second delay on because it seems that the browser does not immediately begin working, so before the delay, the browser would get the url and then the code would check for it being busy, the code was faster and found the browser was not busy and moved on to the rest of the code. As it moved on the browser then would begin it's navigation.
 

Users who are viewing this thread

Back
Top Bottom