|
-
Feb 11th, 2009, 07:58 AM
#1
Thread Starter
Addicted Member
[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
Another light-hearted post from Guru 
-
Feb 11th, 2009, 08:19 AM
#2
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
-
Feb 11th, 2009, 08:24 AM
#3
Thread Starter
Addicted Member
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
Another light-hearted post from Guru 
-
Feb 11th, 2009, 09:07 AM
#4
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.
Last edited by jmsrickland; Feb 11th, 2009 at 09:18 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|