+ Reply to Thread
Results 1 to 4 of 4

get data from web page

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-28-2003
    Location
    Italy
    MS-Off Ver
    11
    Posts
    131

    get data from web page

    Admit have 3 frame in web page.

    frame1 is the top
    frame2 central
    frame 3 bottom

    i want to get the data from the cell of table in central frame and isert in a excel sheet.
    The data to get are only no blank cell in this case are:

    IMPARATO SALVATORE in cell A1
    A16492.19 in cell B1
    6477 in cell C1
    Q.D.3 ....
    00024683 ......
    8505 .....
    ADD.SERVIZI GENERALI ....
    123456.....
    REGIONE SUD....
    SERVIZI GENERALI cell L

    attached html code of central frame.

  2. #2
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    Hello


    To attain a particular frame in html page:

        Dim IE As internetExplorer
        Dim maPageHtml As HTMLDocument
        Dim Helem As HTMLElementCollection
        
        Set IE = CreateObject("internetExplorer.Application")
        IE.Visible = True
        IE.navigate "http://maWebPage.html"
            Do Until IE.readyState = READYSTATE_COMPLETE
            DoEvents
            Loop '
        
        Set maPageHtml = IE.document
        
        'frames.Item(1) is the second frame in the html page
        MsgBox maPageHtml.frames.Item(1).document.documentElement.innerText


    To import table datas:
    http://www.excelforum.com/showthread.php?t=622320




    Regards
    michel
    Last edited by michelxld; 11-11-2007 at 02:47 AM.

  3. #3
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    Hello

    you will have to adapt the result in cells:

        Dim IE As internetExplorer
        Dim maPageHtml As HTMLDocument
        Dim Htable As IHTMLElementCollection
        Dim maTable As IHTMLTable
        Dim x As Integer, i As Integer, j As Integer
        Dim Ligne As Integer
        
        Set IE = CreateObject("internetExplorer.Application")
        IE.Visible = True
        IE.navigate "http://maPageWeb.html"
            Do Until IE.readyState = READYSTATE_COMPLETE
            DoEvents
            Loop '
        
        Set maPageHtml = IE.document
        'frames.Item(1) is the second frame in the html page
        Set Htable = maPageHtml.frames.Item(1).document.getElementsByTagName("table")
        
        'tables in second frame
        For x = 0 To Htable.Length - 1
            Set maTable = Htable(x)
            
            'rows in table
            For i = 0 To maTable.Rows.Length - 1
                Ligne = Ligne + 1
                
                'each cell in row
                For j = 0 To maTable.Rows(i).Cells.Length - 1
                    Cells(Ligne, j + 1) = maTable.Rows(i).Cells(j).innerText
                Next j
            Next i
        Next x
        
        IE.Quit
        Set IE = Nothing


    regards
    michel

  4. #4
    Forum Contributor
    Join Date
    10-28-2003
    Location
    Italy
    MS-Off Ver
    11
    Posts
    131
    Quote Originally Posted by michelxld
    Hello

    you will have to adapt the result in cells:

        Dim IE As internetExplorer
        Dim maPageHtml As HTMLDocument
        Dim Htable As IHTMLElementCollection
        Dim maTable As IHTMLTable
        Dim x As Integer, i As Integer, j As Integer
        Dim Ligne As Integer
        
        Set IE = CreateObject("internetExplorer.Application")
        IE.Visible = True
        IE.navigate "http://maPageWeb.html"
            Do Until IE.readyState = READYSTATE_COMPLETE
            DoEvents
            Loop '
        
        Set maPageHtml = IE.document
        'frames.Item(1) is the second frame in the html page
        Set Htable = maPageHtml.frames.Item(1).document.getElementsByTagName("table")
        
        'tables in second frame
        For x = 0 To Htable.Length - 1
            Set maTable = Htable(x)
            
            'rows in table
            For i = 0 To maTable.Rows.Length - 1
                Ligne = Ligne + 1
                
                'each cell in row
                For j = 0 To maTable.Rows(i).Cells.Length - 1
                    Cells(Ligne, j + 1) = maTable.Rows(i).Cells(j).innerText
                Next j
            Next i
        Next x
        
        IE.Quit
        Set IE = Nothing


    regards
    michel
    WORK!

    But is possible to copy all value finded in one line strtaed from E2..
    Example E2, F2, G2, ...L2 until last value in html table
    Tks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1