CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005
    Posts
    79

    get value from the table web page

    Based this link:

    https://www.tuttitalia.it/italia/

    how to get all value from web table?

    tks.

    my pooer code:

    Sub TEST()

    Dim oDom As Object: Set oDom = CreateObject("htmlFile")
    Dim X As Long, Y As Long
    Dim oRow As Object, oCell As Object
    Dim data

    Y = 1: X = 1

    With CreateObject("msxml2.xmlhttp")
    .Open "GET", "https://www.tuttitalia.it/italia/", False
    .send
    oDom.body.innerHTML = .responseText
    Do: DoEvents: Loop Until .readyState = 4
    End With

    With oDom.getElementsByClassName("table")(4)

    Debug.Print .rows.length
    Debug.Print .rows(1).cells.length

    ReDim data(1 To .rows.length, 1 To .rows(1).cells.length)

    For Each oRow In .rows

    For Each oCell In oRow.cells
    'If UCase(oCell.innerText) > "" Then
    data(X, Y) = UCase(oCell.innerText)
    'End If
    Y = Y + 1
    Next oCell

    Y = 1
    X = X + 1

    Next oRow

    End With

    End Sub

    note:
    The table is in the botton of page.
    Attached Images Attached Images

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,903

    Re: get value from the table web page

    You'll probably get more responses if you post this question on this site's sister site
    https://www.vbforums.com/forumdispla...-6-and-Earlier
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

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

Featured