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
| Sub connexion()
' référence Microsoft Internet Controls
Dim ie As InternetExplorer
Dim IEdoc As Object
Dim DOCelement As Object
Dim sRecherche As String
sRecherche = InputBox("Quelle recherche?")
Set ie = New InternetExplorer
ie.Visible = True
ie.Navigate ("<a href="http://www.google.ca" target="_blank">http://www.google.ca</a>")
' attente de fin de chargement
Do Until ie.ReadyState = 4
DoEvents
Loop
Set IEdoc = ie.Document
Set DOCelement = IEdoc.getElementsByName("q").Item
On Error GoTo fin '<-- en cas de mémorisation du login et du mdp
DOCelement.Value = sRecherche
Set DOCelement = IEdoc.getElementsByName("btnG").Item
DOCelement.Click
fin:
End Sub |