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
| Sub Exemple()
Dim IE As New InternetExplorer
Dim IEdoc As HTMLDocument
Dim IEdoc2 As HTMLDocument
Dim FormExCherche As HTMLFormElement
Dim InputExZoneTexte As HTMLInputElement
Dim InputExZoneTexte2 As HTMLInputElement
Dim InputExBouton As HTMLInputElement
'Connexion à une première page web
IE.navigate "www.mon-site"
IE.Visible = True
Do Until IE.readyState = READYSTATE_COMPLETE
DoEvents
Loop
'Entrée de l'identifiant puis clic sur un bouton pour ouvrir une seconde page web
Set IEdoc = IE.document
Set InputExZoneTexte = IEdoc.all("Nom de la zone de texte login")
InputExZoneTexte.Value = "Mon identifiant"
Set InputExBouton = IEdoc.all("Nom du bouton")
InputExBouton.Click
Do Until IE.readyState = READYSTATE_COMPLETE
DoEvents
Loop
'Jusque là tout va bien. Le code s'exécute correctement, même en n'étant pas en mode 'pas à pas'. C'est ensuite qu'il ne s'exécute plus si je ne suis pas en 'pas à pas'.
'Entrée du mot de passe sur une seconde page web
Set IEdoc2 = IE.document
Set InputExZoneTexte2 = IEdoc2.all("Nom de la zone de texte password")
InputExZoneTexte2.Value = "Mon mot de passe"
Set FormExCherche = IEdoc2.forms("Nom de la form")
FormExCherche.submit
Do Until IE.readyState = READYSTATE_COMPLETE
DoEvents
Loop
Set IE = Nothing
Set IEdoc = Nothing
Set IEdoc2 = Nothing
End Sub |
Partager