Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Webbrowser Document Body innerHTML problem 1

Status
Not open for further replies.

GPerk

Programmer
Jul 6, 2002
161
US
I am using Webbrowser to get web pages:
Private Sub WB_DocumentComplete(ByVal pDisp As Object, URL As Variant)
txtHTML.Text = WB.Document.Body.innerHTML ' <- Err
txtURL.Text = WB.LocationURL
End Sub

Each time I run the program I get Error 91,
Object variable or With block variable not set.

I click 'Debug', move my cursor to the line marked Err above,
change any letter on that line to upper case, then
click the Start button in the IDE, and Voila!! - the program runs correctly!!
It does this every time I run the program.

Anyone have a clue about what's causing this?
Do I need to change the coolant in my radiator?
 
I have written quite a few webbrowser applications and have had the same situation.!!!

The Webbrowser has a problem of firing the document_complete too early. ie the page is still loading.

In your code where you call the page, place..

Do Until Webbrowser1.ReadyState = 4 'READY_STATE_COMPLETE
doevents
Loop

BUT>>!! I have found i have had to on some occassions to have a bit of code ,in addition, to the above. ie the readystate is also doubtful.

eg

for x=1 to 2000
next x
ie. to slow the whole process down.


I also use
WebBrowser1.Document.documentElement.InnerHTML

Hope this helps .

Regards Kennedymr2

 
Thanks a lot!

This not only solved the problem but cleared up the mystery as well.

And it is easier than changing the coolant.
 
I don't think that you'll find that either of those articles refer to the problem you were experiencing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top