1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| Sub testrequete()
With Sheets("resultat"): .Activate: .Cells.Clear: End With
For i = 2 To Sheets(1).Cells(Rows.Count, 1).End(xlUp).Row
requete Sheets(1).Cells(i, 1).Value
Next
deleteshap
MsgBox "terminé!!"
End Sub
Sub requete(url)
Dim req
Set req = CreateObject("microsoft.xmlhttp")
req.Open "POST", url, False
req.send
With CreateObject("htmlfile")
.body.innerhtml = req.responsetext
Set tables = .getelementsbytagname("TABLE")
texte = "<style>TD{border:1px solid black;}</style>" & vbCrLf & "<font color=red><strong>" & .getelementsbytagname("H1")(0).innertext & "</strong><br> musique :" & .getelementsbytagname("H3")(0).innertext & "</font>" & tables(1).outerhtml & tables(3).outerhtml
If .parentWindow.clipboardData.setData("Text", texte) Then
Application.ScreenUpdating = False
With Sheets("resultat")
.Cells(Rows.Count, 1).End(xlUp).Offset(3, 0).Select
.Paste
.Columns("A:z").AutoFit
End With
.parentWindow.clipboardData.clearData "Text"
End If
End With
End Sub
Sub deleteshap()
For Each shap In Sheets(2).Shapes
shap.Delete
Next
End Sub |
Partager