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
| Sub IEViaVBAExcel2()
Dim IE As New InternetExplorer
Dim IEDoc As HTMLDocument
Dim htmlTagCol As IHTMLElementCollection
Dim Generic As HTMLGenericElement
'Ouvre la page Web
IE.navigate "http://fr.wikipedia.org/wiki/Wikip%C3%A9dia:Accueil_principal"
IE.Visible = True
WaitIE IE
Set IEDoc = IE.document
'On liste les éléments de type anchor
Set htmlTagCol = IEDoc.getElementsByTagName("a")
Set Generic = htmlTagCol.Item("Portail:Histoire")
Generic.Click
Set IE = Nothing
Set IEDoc = Nothing
End Sub
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 |