Home All Groups Group Topic Archive Search About

webbroswer source problem

Author
21 Oct 2005 6:54 PM
Bala
Hi

I try to get the html source from webbrowser control. its giving me 'object
variable or block variable not set'. How to solve this?

ss = "www.website.com"
Me.WebBrowser1.Navigate2 ss
Do While True = (Me.WebBrowser1.Document Is Nothing)
    DoEvents
Loop
Text2.Text = WebBrowser1.Document.body.innerHTML  -----------**ERROR**

bala

Author
21 Oct 2005 7:34 PM
Norm Cook
Try this instead

Private Sub Form_Load()
Dim ss As String
ss = "www.website.com"
Me.WebBrowser1.Navigate2 ss
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As
Variant)
If (pDisp Is WebBrowser1.object) Then
'this gets the html
  Text2.Text = pDisp.Document.documentElement.innerHTML
'this gets the text
'  Text2.Text = pDisp.Document.documentElement.innerText
End If
End Sub

Show quoteHide quote
"Bala" <B***@discussions.microsoft.com> wrote in message
news:2FAF8972-66DB-4318-A5F4-DA9E9E4AAFF3@microsoft.com...
> Hi
>
> I try to get the html source from webbrowser control. its giving me
'object
> variable or block variable not set'. How to solve this?
>
> ss = "www.website.com"
> Me.WebBrowser1.Navigate2 ss
> Do While True = (Me.WebBrowser1.Document Is Nothing)
>     DoEvents
> Loop
> Text2.Text = WebBrowser1.Document.body.innerHTML  -----------**ERROR**
>
> bala
>
Are all your drivers up to date? click for free checkup

Author
22 Oct 2005 4:58 AM
Bala
Thanks. problem solved.

bala

Show quoteHide quote
"Norm Cook" wrote:

>
> Try this instead
>
> Private Sub Form_Load()
>  Dim ss As String
>  ss = "www.website.com"
>  Me.WebBrowser1.Navigate2 ss
> End Sub
>
> Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As
> Variant)
>  If (pDisp Is WebBrowser1.object) Then
>  'this gets the html
>   Text2.Text = pDisp.Document.documentElement.innerHTML
>  'this gets the text
> '  Text2.Text = pDisp.Document.documentElement.innerText
>  End If
> End Sub
>
> "Bala" <B***@discussions.microsoft.com> wrote in message
> news:2FAF8972-66DB-4318-A5F4-DA9E9E4AAFF3@microsoft.com...
> > Hi
> >
> > I try to get the html source from webbrowser control. its giving me
> 'object
> > variable or block variable not set'. How to solve this?
> >
> > ss = "www.website.com"
> > Me.WebBrowser1.Navigate2 ss
> > Do While True = (Me.WebBrowser1.Document Is Nothing)
> >     DoEvents
> > Loop
> > Text2.Text = WebBrowser1.Document.body.innerHTML  -----------**ERROR**
> >
> > bala
> >
>
>
>

Bookmark and Share