Hello everyone and thanks in advance.
I'm trying to download a table to excel from the page mismarcadores.com.
I've got a macro on the internet. The problem is that the html tag of the table has no ID, and whenever I execute the macro, the following error occurs:
Error 438 occurred at runtime: The object does not support this property or method
The macro that I execute is the following:
Public Sub importartblhtml()
Dim appIE As Object
Dim allRowOfData As Object
Dim curHTMLRow As Object
Dim Fila As Long, Col As Long
Dim Celda As Object
Set appIE = CreateObject("internetexplorer.application")
With appIE
.Visible = True
.navigate "https://www.mismarcadores.com/futbol/espana/laliga/partidos/"
While .Busy = True Or .readyState < 4: DoEvents: Wend
ThisWorkbook.Sheets("Hoja1").Activate
Cells.Select
Selection.ClearContents
Set allRowOfData = appIE.document.getElementsById("")
For Fila = 1 To allRowOfData.Rows.Length - 1
Set curHTMLRow = allRowOfData.Rows(Fila)
For Col = 0 To curHTMLRow.Cells.Length - 1
Set Celda = Sheets("Hoja1").Cells(Fila + 1, Col + 1)
Celda.Value = "'" & curHTMLRow.Cells(Col).innertext
Next Col
Next Fila
.Quit
End With
Set appIE = Nothing
Set curHTMLRow = Nothing
Set Celda = Nothing
End Sub
The error jumps when the line is executed
Set allRowOfData = appIE.document.getElementsById("")
I've tried with the getElementsByTag("table")(0)
method
and it does not work either It matters the whole page except what I want, which are the matches.
I have not found much information on the internet about how to solve the error.
The html code from where I want to get the data is the following
Does anyone know if I need to activate a reference or some other method to download this table?
Thanks.
Greetings.