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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
| Sub RechercheVBAExcel()
'Déclaration des variables
Dim IE As New InternetExplorer
Dim IEDoc As HTMLDocument
Dim InputGoogleZoneTexte As HTMLInputElement
Dim InputGoogleBouton As HTMLInputElement
Dim htmlTagCol As IHTMLElementCollection
Dim htmlSelectElem As HTMLSelectElement
'Dim Generic As HTMLGenericElement
'Dim iCollection As IHTMLElementCollection
'Chargement d'une page Web Google
IE.Navigate "http://www.eauvive.info/admin"
'Affichage de la fenêtre IE
IE.Visible = True
'On attend le chargement complet de la page
WaitIE IE
'On pointe le membre Document
Set IEDoc = IE.document
'On pointe notre Zone de texte
Set InputGoogleZoneTexte = IEDoc.all("ident")
On Error Resume Next
'On définit le texte que l'on souhaite placer à l'intérieur
InputGoogleZoneTexte.Value = "*****"
On Error Resume Next
Set InputGoogleZoneTexte = IEDoc.all("mdp")
'On définit le texte que l'on souhaite placer à l'intérieur
InputGoogleZoneTexte.Value = "*****"
Set InputGoogleBouton = IEDoc.all("sub")
'On simule un clic
InputGoogleBouton.Click
'On attend la fin de la recherche
WaitIE IE
IE.Navigate "http://www.eauvive.info/admin.php?gestionsejour"
WaitIE IE
Set InputGoogleBouton = IEDoc.all("formGestionSejour")
'On simule un clic
InputGoogleBouton.Click
WaitIE IE
'-----------------------------------------------------------------------------
'Set IEDoc = IE.document
Set htmlSelectElem = IEDoc.all("participant_sejour_sejour_id")(1)
'On sélectionne l'indice "56" via sa valeur unique
htmlSelectElem.Value = "56"
htmlSelectElem.Click
'## Autre solution ##
'On sélectionne l'indice "ter" via l'index
'htmlSelectElem.selectedIndex = 2
' htmlSelectElem.Click
WaitIE IE
Set IE = Nothing
Set IEDoc = Nothing
End Sub |
Partager