LarsLarsen
New Member
- Joined
- Jul 20, 2015
- Messages
- 2
Hey,
I'm trying to obtain the id's of rows in a table on a website (the url is in the code). My problem is that I can't find the table. When I run the code it tells me that only one table exist, and that is not the one I'am looking for. Can someone please explain to me why it only returns the last table?
If for any need the XPath of the table is (google chrome): //*[@id="fs-fixtures"]/table/tbody
Best regards
Lars
I'm trying to obtain the id's of rows in a table on a website (the url is in the code). My problem is that I can't find the table. When I run the code it tells me that only one table exist, and that is not the one I'am looking for. Can someone please explain to me why it only returns the last table?
If for any need the XPath of the table is (google chrome): //*[@id="fs-fixtures"]/table/tbody
Best regards
Lars
Code:
Sub BrowseTableIds()
Dim XMLPage As New MSXML2.XMLHTTP60
Dim HTMLDoc As New MSHTML.HTMLDocument
Dim HTMLTables As MSHTML.IHTMLElementCollection
Dim HTMLTable As MSHTML.IHTMLElement
XMLPage.Open "GET", "http://www.flashscore.dk/fodbold/england/premier-league/kommende/", False
XMLPage.send
HTMLDoc.body.innerHTML = XMLPage.responseText
Set HTMLTables = HTMLDoc.getElementsByTagName("table")
For Each HTMLTable In HTMLTables
Debug.Print HTMLTable.ID, HTMLTable.className
Next HTMLTable
Debug.Print HTMLTables.Length
End Sub