[RESOLVED] Webbrowser control - grabbing text from frame
I can grab the page contents of a webpage easily enough using the following code:
Code:
Private Sub WebBrowser3_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim doc As HTMLDocument
Dim strtemp As String
Set doc = WebBrowser3.Document
strtemp = doc.body.innerHTML 'page contents
End Sub
BUT! The page is a frames page and I want to grab the contents of of one of the frames.
Any idea how I can do that?
I presume it's doc.frames(1). but what next?
Thanks
Re: Webbrowser control - grabbing text from frame
doc.Document.frames("name-of-frame").Document.documentElement.innerHTML
or
doc.Document.frames(index-of-frame).Document.documentElement.innerHTML
Re: Webbrowser control - grabbing text from frame
Yay thanks!
I had to takeout the first 'Document' though so I had:
doc.frames("name-of-frame").Document.documentElement.innerHTML
Re: [RESOLVED] Webbrowser control - grabbing text from frame
I would think that only this one would work
WebBrowser1.Document.frames("name-of-frame").Document.documentElement.innerHTML
If I use your statement I will get an error Object doesn't support this property or method
AFTER POST EDIT:
OK, never mind, I see what you did; you already set doc to WebBrowser3.Document which I didn't. So you don't need to do this then:
Dim doc As HTMLDocument
Set doc = WebBrowser3.Document
unless you have other reasons to do so.