[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • 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

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

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