WebBrowser DocumentComplete & Frames Problem
I have the following trouble with the documentcomplete event.
--------------------
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As
Variant)
Text3.Text = _ WebBrowser1.Document.frames(3).Document.body.innertext
End Sub
----------------
The problem is that the Documentcomplete sub routine fires before the page
shows in the webbrowser window. I have tried with for next loops and the
timer control to force delays several praces in the code, but that seems to
halt the web browser control.
If I add a message box and wait till the page shows, it works fine.
Any help will be highly appreaciated as this problem is driving me mad! :-)
Best regards
pokpoki
Re: WebBrowser DocumentComplete & Frames Problem
Have you tried the downloadcomplete instead of documentcomplete?
Re: WebBrowser DocumentComplete & Frames Problem
This is from the Microsoft website:
Code:
Private Sub myIE_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If pDisp Is myIE Then
DocComplete = True
End If
End Sub
And then test:
Code:
DocComplete = False '<---- set module level boolean variable
myIe.navigate ("http:\yourpage.com") '<---- Load Page here
Do Until DocComplete = True
DoEvents
Loop
Text3.Text = MyIE.Document.frames(3).Document.body.innertext
This code ensures that the whole page is loaded.