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
| Option Compare Database
Option Explicit
Sub WaitIE(IE As InternetExplorer)
'On boucle tant que la page n'est pas totalement chargée
Do Until IE.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
End Sub
Sub RechercheVBAExcel()
'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
'Chargement d'une page Web Google
IE.navigate "www.google.com/finance"
'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("q")
'On définit le texte que l'on souhaite placer à l'intérieur
InputGoogleZoneTexte.Value = "VSAR"
'On pointe notre bouton
Set InputGoogleBouton = IEDoc.all("gbqfb")
'On simule un clic
InputGoogleBouton.Click
'On attend le chargement complet de la page
WaitIE IE
'On libère les variables
Set IE = Nothing
Set IEDoc = Nothing
End Sub |
Partager