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 54 55 56 57 58 59 60 61 62 63
| Sub testlbc2()
Dim URL_Annonce As String
URL_Annonce = "http://www.leboncoin.fr/consoles_jeux_video/610172498.htm"
Dim IE As New InternetExplorer
'Affiche IE
IE.Visible = True
'Ouvre la page WEB avec l'annonce à supprimer
IE.navigate URL_Annonce
'Attends que la page soit chargée et que internet explorer soit prêt
Wait_IE_Ready IE
'Ramene la fenêtre Internet Explorer au 1er plan au cas ou elle serait en arrière plan
BringWindowToTop CLng(IE.Hwnd)
'On cherche le lien pour supprimer
For Each href In IE.Document.links
If href.outerText = "Supprimer" Then
href.Click
Exit For
End If
Next
'----> ça plante ici : la variable IE n'existe plus... vu dans l'espion...
'Attends que la page soit chargée et que internet explorer soit prêt
Wait_IE_Ready IE
End Sub
Sub Wait_IE_Ready(ByVal Fen_IE As InternetExplorer)
'Attends que la page soit chargée et que internet explorer soit prêt
'Déclaration des Constantes pour Internet Explorer :
Const READYSTATE_INTERACTIVE = 3
Const READYSTATE_COMPLETE = 4
Do While Fen_IE.ReadyState <> READYSTATE_INTERACTIVE
DoEvents
Loop
Do While Fen_IE.ReadyState <> READYSTATE_COMPLETE
DoEvents
Loop
End Sub |
Partager