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
| 'cocher Microsoft Internet Controls et Microsoft HTML Object Library
Const MY_URL As String = "https://www.google.fr/"
Const IDENTIFIANT As String = "12345678"
Sub PiloterInternet()
Dim IE As SHDocVw.InternetExplorer
Dim IEDoc As HTMLDocument
'Set IE = CreateObject("InternetExplorer.Application")
Set IE = New SHDocVw.InternetExplorer
With IE
.Silent = False
.Navigate MY_URL
.Visible = True
Do Until .readyState = 4: DoEvents: Loop
End With
Set IEDoc = IE.Document
Dim oQ As HTMLInputElement, oBtnK As HTMLInputElement
Set oQ = IEDoc.getElementsByName("q").Item(0)
oQ.Value = IDENTIFIANT
Set oBtnK = IEDoc.getElementsByName("btnK").Item(0)
oBtnK.Click
'là je n'ai pas compris...
' Set Element = .Document.getElementById("gb_70") 'On récupère le nom écrit dans le bouton connexion, ici connexion
' .Visible = True
Set IE = Nothing
End Sub |
Partager