Excel avec internet explorer
Bonjour forum,
J'ai un code qui permet de sélectionner, un type de paris ainsi que sa mise, mais j'aimerais qu'il interagisse avec excel pour choisir la bonne case a cocher. Supposons que sur une feuille C3 = 1 et que C4 = 2 ainsi de suite jusque 20 si C3 = 1 alors il mise sur le site en question
Pour l'exemple je vais prendre cette page là
https://www.zeturf.fr/fr/course/2019...s-princes/turf
le code principal
Code:
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
| Sub Mise_Zeturf()
Dim IE As Object, IEDoc As Object
Dim Boutons As Object, Tables As Object
Dim I As Integer, J As Integer, Url As String
Dim LaDate As String, LaReunion As String, LaCourse As String, LePrix As String
If Sheets("Accueil").Range("L2") Then
LaDate = Format(Sheets("Accueil").Range("L2"), "yyyy-mm-dd")
LaReunion = Format(Sheets("Accueil").Range("A1"), "General")
LaCourse = Format(Sheets("Accueil").Range("A2"), "General")
LePrix = Format(Sheets("Accueil").Range("A3"), "General")
Url = "https://www.zeturf.fr/fr/course/" & LaDate & "/" & LaReunion & LaCourse & "-" & LePrix & "/" & "turf"
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate Url
Do Until IE.ReadyState = 4
DoEvents
Loop
Set IEDoc = IE.document
Set Boutons = IEDoc.getElementsByTagName("button")
For I = 0 To Boutons.Length - 1
If Boutons(I).classname = "chk-change-pari paris-arrondi_79x40_2" Then Exit For
Next I
Boutons(I).Click
Boutons(I).Click
Set Boutons = IEDoc.getElementsByTagName("button")
For I = 0 To Boutons.Length - 1
If Boutons(I).classname = "montant-plus " Then Exit For
Next I
Boutons(I).Click
Boutons(I).Click
Boutons(I).Click ' <<< 3 click = 4
End If
'IE.Quit
Set Tables = Nothing
Set Boutons = Nothing
Set IEDoc = Nothing
Set IE = Nothing
End Sub |
et donc en résultat si C3 = 1 ça devrait donné en image.
https://image.noelshack.com/minis/20...sans-titre.png
Merci a tous pour l'aide apporté