Hello,
impressing, thanks! It took me a while to understand but I finally made it.
I tried your code and have even been able to check if I'm on the right page by running through the items and searching for a specific team (which was fortunately found).
Now I have the next problem: I don't know how to get the right information on the page. Of course I could put all football teams into an array and check if the string of the current item is equal to the strings in the array. But that wouldn't help me to find the bets and odds since they change of course. I tried to find the height of the found team (example: "Real Madrid", height: 144) in order to get the bets which are right to the teams. It didn't work out for me.
Another approach was to use you first suggestion (using the Microsoft.xmlHTTP Object) but from my point of view I have the same problem like at the beginning since creating this object requires a URL which is not correct in my case because it doesn't deliver the right information before clicking two buttons. Is there any way to transfer the items I already have into the FinHTTP-object?
I don't know how to deal with that, I need the information (games, bets, odds) listed like in your first approach.
Here's the code (only the last few rows are "new"):
Sub Laliga()
Worksheets("Odds").Select
range("A1:Z2000") = ""
Dim Items As IHTMLElementCollection
Dim Item As IHTMLElement
Dim QFields As IHTMLElementCollection
Dim QField As IHTMLElement
Dim HTMLDoc As HTMLDocument
meta = "<meta itemdrop"
Result = "result_pk"
Dim str As String
indi = 2
Dim inarr As Variant
Dim outarr As Variant
Set FinHTTP = CreateObject("Microsoft.xmlHTTP")
Dim FinRows, FinCols
Dim RowNumber As Long
Dim ItemId As String
Exitf = False
Dim tsext As String
Dim ie As Object 'ie --> InternetExplorer als Objekt einrichten und Seite öffnen
Set ie = CreateObject("InternetExplorer.Application")
ie.navigate "LINK" (still not able to post Links here)
ie.Visible = True
Do While ie.Busy And Not ie.readyState = 4
DoEvents
Loop
DoEvents
Set HTMLDoc = ie.document 'Internet Explorer als HTML-Dokument darstellen
i = 1
Set Items = HTMLDoc.all 'IHTML-Elemente mit HTML-Elementen füllen
For Each Item In Items 'Find the button "Show bet options"
Set QFields = Item.all
For Each QField In QFields
i = 1
tsext = QField.innerText
flagt = InStr(tsext, "Show bet options")
flagc = InStr(QField.outerHTML, "more_types onclick")
If flagt = 1 And flagc = 14 Then
QField.Click
Exitf = True
Exit For
End If
Next QField
If Exitf Then
Exit For
End If
Next Item
i = 1
For Each Item In Items 'Find the button "Over/Under points in Match"
Set QFields = Item.all 'Alle Items der Seite "Over/Under points in Match" QFields zuordnen
Exitf = False
For Each QField In QFields
tsext = QField.innerText
flagt = InStr(tsext, "Over/Under points in Match")
flagc = InStr(QField.outerHTML, "more_types onclick")
If flagt = 1 Then '--> button found
QField.Click
i = i + 1
Exitf = True
Exit For
End If
Next QField
If Exitf Then
Exit For
End If
Next Item
i = 1
'Added code
FinHTTP = Items 'Copy the information into Excel
FinRows = Split(FinHTTP.responseText, Chr(10))
For j = 0 To UBound(FinRows) - 1
str = FinRows(j)
If InStr(str, meta) > 0 Or InStr(str, Result) > 0 Then
Cells(indi, 1) = FinRows(j)
indi = indi + 1
End If
Next j
Set document = Nothing
Set Browser = Nothing
End Sub
Thanks for helping me so much!