Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NOT FOR ME, get value from table web

sal21

Programmer
Apr 26, 2004
489
IT

Based this lin, how to get numeric value from each table, for:

Bari
Bari
Milano
Firenze
Torino

Note:
the number of table is dinamic

my test code:

Rich (BB code):
Option Explicit
Private Sub Command1_Click()

Dim objHtml As MSHTML.HTMLDocument
Dim objDoc As MSHTML.HTMLDocument
Dim strUrl As String
Dim col As MSHTML.IHTMLElementCollection
Dim element As MSHTML.HTMLInputElement

    strUrl = "https://www.lottologia.com/lotto/previsioni-gruppi-omogenei/"
    
    Set objHtml = New HTMLDocument
    Set objDoc = objHtml.createDocumentFromUrl(strUrl, vbNullString)
    
    Do While objDoc.ReadyState <> "complete"
        DoEvents
    Loop
  
    Set col = objDoc.getElementsByTagName("div")
    For Each element In col
        If element.className = "series col-12" Then
            Debug.Print element.innerText
        End If
    Next element
    
    Set col = Nothing
    Set objDoc = Nothing
    Set objHtml = Nothing
    
End Sub
 
Last edited:
do not consider tyhe first question...

Thi is the new problem.
Get value from table cell

My test cdoe

Sub Getvalue()

Dim htm As HTMLDocument
Set htm = New HTMLDocument
Dim CLS As Object
Dim lRow As Long

With CreateObject("msxml2.xmlhttp")
.Open "GET", "https://www.lotto-italia.it/lotto/ritardatari-frequenti/ambi-frequenti", False
.send
htm.body.innerHTML = .responseText
End With

For Each CLS In htm.getElementsByClassName("table table-striped center")

lRow = lRow + 1

Next CLS

End Sub
 

Part and Inventory Search

Sponsor

Back
Top