how to slowdown or pause a loop waiting for a web page to load?

D

Daniel M

I have a form that submits a web post using the ms browser activex add in.

wbbWebsite.Navigate URL:=msgtextstring

I should then get back a message back from the web page like this
"ACCEPTED=2008041100025654OBMREF=815553RESULT=success " but if i submit
another post before this one succeds then it doesnt take it.

I have this in a loop and am trying to summit all of my posts at once. Right
now only the last one goes through because it goes too fast for the web page
to load. is there anyway i can either wait for the web page to load or wait
a specified time between posts?
 
D

Dirk Goldgar

Daniel M said:
I have a form that submits a web post using the ms browser activex add in.

wbbWebsite.Navigate URL:=msgtextstring

I should then get back a message back from the web page like this
"ACCEPTED=2008041100025654OBMREF=815553RESULT=success " but if i submit
another post before this one succeds then it doesnt take it.

I have this in a loop and am trying to summit all of my posts at once.
Right now only the last one goes through because it goes too fast for the
web page to load. is there anyway i can either wait for the web page to
load or wait a specified time between posts?


Are you talking about the Microsoft Web Browser ActiveX control? Doesn't
that control have .Busy property that you loop on, to wait for it to finish?
Something like:

With Me.wbbWebsite
.Navigate URL:=msgtextstring
Do While .Busy
DoEvents
Loop
End With

I'm not very familiar with it, so I could be wrong.
 
D

Dirk Goldgar

Daniel M said:
It still doesnt seem to work. Any other ideas? Thanks.


I'd need to see more of your code, and have more information about what's
happening than "it doesn't work". Do you get an error; if so, what is it?

I can't promise anything, though. As I said, I don't have much experience
with the web browser control. If you don't actually need to display the web
site's content, there are other mechanisms you can use to communicate with
it. I'm not deeply familiar with them, either, but they seem on the face of
it more suited to what you're doing. So if we can't make this work, I could
suggest one of them.
 
D

Daniel M

OK i created a dummy form for testing. It contains 1 command button and the
web control. here is the code.

Private Sub Command1_Click()

With Me.wbbWebsite
.Navigate URL:="www.microsoft.com"
Do While .Busy
DoEvents
Loop
End With

With Me.wbbWebsite
.Navigate URL:="www.google.com"
Do While .Busy
DoEvents
Loop
End With
MsgBox "done"

End Sub

Now what i would like to see is the first web page (microsoft) finish
loading before the second page loads (google). What happens is msgbox pops
up immediately. Then the second page loads. I never see the first page.

Thanks.

dm.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top