-
Hi,
I am getting an error on the last line it gives a runtime error "91" with the message object variable or with block variable not set. I get this with just a form and the webbrowser control. And following code at form load:
WebBrowser1.Navigate2 "about:blank"
Dim strHTML As String
strHTML = "Your HMTL Code Here"
WebBrowser1.Document.Body.Innerhtml = strHTML
This happends on 2 different computers one with nt4 and the other with win2000. Vb version is 6. One with sp3 and the other with no sp. Both using internet explorer 5.
Would be great if somebody would have an answer to this.
Greatone
-
Hi,
Whats happening is that your code is trying to write to the document before it has actually loaded. Try putting the following code in to make sure it is loaded before you write to it:
[code]
Private Sub form_load()
WebBrowser1.Navigate2 "about:blank"
Dim strHTML As String
strHTML = "Your HMTL Code Here"
Do Until WebBrowser1.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
WebBrowser1.Document.Body.innerhtml = strHTML
End Sub
Hope this helps
Shaun
-
Or you can just move the code (that you have after the call to Navigate2 method) to the NavigateComplete2 event.
-
Thanks
Hi S@NSIS,
It works!
Thank you very much. I got the code from an other place. It was in a tutorial even without your line in it. This works great!
Greetings
Greatone