• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 182
  • Last Modified:

Getting HTML from particular frame in webbrowser

I'm able to get the body html from the webbrowser by using this command:

t1.text = WebBrowser1.Document.body.innerhtml

but if the webpage uses frames how do I specify that I want the source from a particular frame?
0
basica
Asked:
basica
  • 3
  • 2
1 Solution
 
samopalCommented:

GetFrame WebBrowser1.Document

Function GetFrame(objFr as object) as string
dim Fr as object

For each Fr in objFr.Frames
 getframe Fr.Document
next

debug.print objFr.body.InnerHTML
end function

HTH
0
 
basicaAuthor Commented:
I get runtime error 91: object variable or with block variable not set, on this line....

For Each Fr In objFr.Frames
0
 
basicaAuthor Commented:
Actually, ignore that last comment, that's because there was no page in the webbrowser.  But now when there is a page in there I get this error:

[438] object doesn't support this property or method, on this line...

For Each Fr In objFr.frames
0
 
basicaAuthor Commented:
Thanks.. I sorted it out.. I managed to get the html of the frame by doing this:

Text1.Text =
WebBrowser1.Document.
frames(x).Document.body.innerhtml
0
 
samopalCommented:
Try to change code :

If objFr.Frames.length > 0 then
For each Fr in objFr.Frames
 getframe Fr.Document
next
end if

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now