buongiorno
excel
avrei un quesito da porvi in merito alla macro da voi suggerita.
come posso modificarla per poter importare le varie tabelle con link.
vorrei importare per esempio questa tabella con i collegamenti.
questo è il link
https://www.betexplorer.com/soccer/alge ... n&dcheck=0
macro da voi suggerita
in parte funziona
Sub Call1()
Sheets("Foglio3").Select '<<< Il foglio su cui si fara' l'importazione
Range("A:X").ClearContents 'NB: Il fofglio SARA' AZZERATO senza preavviso
Range("A:X").NumberFormat = "@" 'Colonne in formato Testo
Call GetTabbbSub(Range("Z1").Value) ' "Chiama" la GetTabbbSub
Range("A:X").WrapText = False
End Sub
Sub GetTabbbSub(ByVal myURL As String)
'Va Chiamata passandogli l'URL da leggere
Set IE = CreateObject("InternetExplorer.Application")
'
With IE
.navigate myURL
.Visible = True
'Stop 'Vedi TESTO
Do While .Busy: DoEvents: Loop 'Attesa not busy
Do While .readyState <> 4: DoEvents: Loop 'Attesa documento
End With
'
myStart = Timer 'attesa addizionale
Do
DoEvents
If Timer > myStart + 1 Or Timer < myStart Then Exit Do
Loop
'Scrive le tabelle SUL FOGLIO ATTIVO
Set myColl = IE.document.getElementsByTagName("TABLE")
For Each myItm In myColl
Cells(I + 1, 1) = "Table# " & ti + 1
ti = ti + 1: I = I + 1
For Each trtr In myItm.Rows
For Each tDtD In trtr.Cells
Cells(I + 1, j + 1) = tDtD.innerText
Cells(I + 1, j + 1).HorizontalAlignment = xlLeft
'Legge hyperlink:
If InStr(1, tDtD.innerHTML, "href", vbTextCompare) > 0 Then
DoEvents: DoEvents
ActiveSheet.Hyperlinks.Add anchor:=Cells(I + 1, j + 1), _
Address:=tDtD.getElementsByTagName("a")(0).href
End If
If j > 0 And Len(Cells(I + 1, j + 1)) > 2 Then cz = 1
j = j + 1
Next tDtD
'Allinea al centro se e' una Intestazione:
If trtr.classname = "js-tournament" Then
Cells(I + 1, 1).HorizontalAlignment = xlCenter
End If
I = I + 1: j = 0
DoEvents
Next trtr
I = I + 1
Next myItm
'
'Chiusura IE
IE.Quit
Set IE = Nothing
End Sub