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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| Sub WebsiteInfo()
Dim xmlHttpRequest As Object, htmlDoc As Object, X&, lesps As Object, I&
Sheets("Feuil1").Range("D2:D18") = Empty
cheminWeb = "https://l.ffessm.fr/Home/InfoLicence?number=039948&key=F263F3"
Set xmlHttpRequest = CreateObject("MSXML2.XMLHTTP")
xmlHttpRequest.Open "GET", cheminWeb, False
xmlHttpRequest.send
If xmlHttpRequest.Status <> 200 Then
MsgBox " une erreur est intervenue pendant le telechargement des données"
End If
Set htmlDoc = CreateObject("HTMLFile")
htmlDoc.body.innerhtml = xmlHttpRequest.responseText
With htmlDoc
Debug.Print .body.innerhtml
Set lesps = .getElementsByTagName("P")
[d3] = lesps(0).innertext
For I = 0 To lesps.Length - 1
Select Case True
Case InStr(1, lesps(I).innerhtml, "Licence N°") > 0
[D6] = lesps(I + 1).innertext
Case InStr(1, lesps(I).innerhtml, "Né(e) le") > 0 '
[d4] = CDate(Split(lesps(I).innertext, "Né(e) le ")(1))
Case InStr(1, lesps(I).innerhtml, "Date de souscription") > 0 '
[D7] = CDate(lesps(I + 1).innertext)
Case InStr(1, lesps(I).innerhtml, "Date de validité") > 0 '
If X = 0 Then [D8] = lesps(I + 1).innertext: X = 1
'[10] 'non du club' je sais pas ou il faut chercher
'[d11]'N°club 'je sais pas ou il faut chercher
Case lesps(I).innertext = "Assurance"
[D13] = lesps(I + 1).innertext
Case InStr(1, lesps(I).innerhtml, "Date de règlement") > 0 '
[D14] = lesps(I + 1).innertext
Case InStr(1, lesps(I).innerhtml, "Date de validité") > 0 '
If X = 1 Then [D15] = lesps(I + 1).innertext: X = 2
End Select
Next
End With
End Sub |
Partager