Results 1 to 4 of 4

Thread: [RESOLVED] Webbrowser control - grabbing text from frame

  1. #1

    Thread Starter
    Addicted Member Guru's Avatar
    Join Date
    May 2000
    Location
    sulking in the cupboard under the stairs
    Posts
    237

    Resolved [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

  2. #2
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    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

  3. #3

    Thread Starter
    Addicted Member Guru's Avatar
    Join Date
    May 2000
    Location
    sulking in the cupboard under the stairs
    Posts
    237

    Resolved 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

  4. #4
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    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
  •  



Click Here to Expand Forum to Full Width