Link to home
Start Free TrialLog in
Avatar of williamsF1
williamsF1

asked on

mastering WebBrowser1_DocumentComplete?

Just wondering if I can tweek this code...
It works ok when running it live, but when I 'Step Into' during Debuggin, I get stuck in the loop...
I guess I would like to know why the DocumentComplete Event is not fired [or stepped into] during debuging?


Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    pagefinished = 1
End Sub

Private Sub LetsGo()
    pagefinished = 0
    Call WebBrowser1.Navigate(sItem.href)
    Do While pagefinished = 0: DoEvents: Loop
End Sub


p.s. Gin Martinis are better than Vodka?...its friday!!! Cheers
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zzzzzooc
zzzzzooc

Instead of using a variable to flag when the document is complete, you could possible just check if the document is set or not which *should* work the same. Not completely sure though.

Private Sub Command1_Click()
    Call WebBrowser1.Navigate("http://www.yahoo.com")
    Do Until TypeName(WebBrowser1.Document) <> "Nothing"
        DoEvents
    Loop
    Call MsgBox("Finished downloading.")
End Sub
Avatar of williamsF1

ASKER

zzzzooc, this doesnt actuall wait for the document to be finished.
I try to set focus on an object and it fails as it hasn't been loaded yet. Sorry.

So I guess there is no other solution. Emoreau, you 100% sure on that?

Yes that kind of events can't be traced.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
points to emoreau