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
| Sub Open_Pages2()
'Déclaration des variables
Dim IE As New InternetExplorer
Dim IEDoc As HTMLDocument
Dim InputGoogleZoneTexte As HTMLInputElement
Dim InputGoogleBouton As HTMLInputElement
Dim FormGoogleCherche As HTMLFormElement
'Initialisation des variables
Set IE = CreateObject("InternetExplorer.Application")
'Chargement d'une page web Google
IE.navigate "http://www.google.com"
'Affichage de la fenêtre IE
IE.Visible = True
'On attend la fin de la recherche
WaitIE IE
With IE.document
MsgBox .body.ID
End With
'On pointe le membre Document
'Set IEDoc = IE.document
'On pointe notre Zone de texte
'Set InputGoogleZoneTexte = IEDoc.all("q")
'On définit le texte que l'on souhaite placer à l'intérieur
'InputGoogleZoneTexte.Value = "VBA Excel"
'WaitIE IE
'On pointe la Form qui contient Zone de Texte + Bouton (entre autres)
'Set FormGoogleCherche = IEDoc.forms("gbqf")
'On exécute l'action Submit de la Form
'FormGoogleCherche.submit
'WaitIE IE
'On pointe notre bouton
'Set InputGoogleBouton = IEDoc.all("btnK")
'On simule un clic
'InputGoogleBouton.Click
'WaitIE IE
'On libère les variables
Set IE = Nothing
Set IEDoc = Nothing
End Sub |
Partager