Private Sub Rechercher_Click()
Dim plaN
Dim Erreur1
Dim Erreur2
Dim Erreur3
Dim Erreur4
Dim Erreur5
Dim Erreur6
Dim Erreur7
Dim Erreur8
Dim Erreur9
Dim Erreur10
'If Not TextBox1 = "" Then
'plaN = TextBox1
plaN = InputBox("Num de plan")
' référence Microsoft Internet Controls
' référence Microsoft HTML Object Library
Dim IE As InternetExplorer
Dim IEdoc As Object
Dim DOCelement As Object
Dim Cible As HTMLAnchorElement
Debut: Set IE = New InternetExplorer
IE.Visible = True
IE.Navigate "http://www.excel-downloads.com"
' attente de fin de chargement
Do Until IE.ReadyState = 4
DoEvents
Loop
'Set IEdoc = IE.Document
'Set DOCelement = IEdoc.getElementsByName("number").Item
'DOCelement.Value = "*" & plaN & "*"
'Do Until IE.ReadyState = 4
' DoEvents
'Loop
'Set DOCelement = IEdoc.getElementsByName("submitbn").Item
'Do Until IE.ReadyState = 4
' DoEvents
'Loop
'DOCelement.Click
'If Not TextBox1 = "" Then
'simuler l'appui de la touche entrée
'Application.Wait (Now + TimeValue("0:00:01"))
'Application.SendKeys "{enter}"
'End If
'Application.Wait (Now + TimeValue("0:00:7"))
Set DOCelement = IE.Document
'Set Cible = DOCelement.Links(7)
On Error Resume Next
Set Cible = DOCelement.Links(3000)
If Error Then
If Erreur1 = "" Then
Erreur1 = plaN
GoTo Enderreur
End If
If Erreur2 = "" Then
Erreur1 = plaN
GoTo Enderreur
End If
If Erreur3 = "" Then
Erreur1 = plaN
GoTo Enderreur
End If
If Erreur4 = "" Then
Erreur1 = plaN
GoTo Enderreur
End If
If Erreur5 = "" Then
Erreur1 = plaN
GoTo Enderreur
End If
If Erreur6 = "" Then
Erreur1 = plaN
GoTo Enderreur
End If
If Erreur7 = "" Then
Erreur1 = plaN
GoTo Enderreur
End If
If Erreur8 = "" Then
Erreur1 = plaN
GoTo Enderreur
End If
If Erreur9 = "" Then
Erreur1 = plaN
GoTo Enderreur
End If
If Erreur10 = "" Then
Erreur1 = plaN
GoTo Enderreur
End If
End If
Cible.Click
Do Until IE.ReadyState = 4
DoEvents
Loop
Set DOCelement = IE.Document
Application.Wait (Now + TimeValue("0:00:3"))
Set Cible = DOCelement.Links(25)
Cible.Click
Do Until IE.ReadyState = 4
DoEvents
Loop
'Fin de l'erreur
Enderreur:
'Fermeture
IE.Quit
'affichage des erreurs
If Not Erreur10 = "" Then
MsgBox ("Il manque les plans" & " " & Erreur1 & ", " & Erreur2 & ", " & Erreur3 & ", " & Erreur4 & ", " & Erreur5 & ", " & Erreur6 & ", " & Erreur7 & ", " & Erreur8 & ", " & Erreur9 & ", " & Erreur10)
Exit Sub
End If
If Not Erreur9 = "" Then
MsgBox ("Il manque les plans" & " " & Erreur1 & ", " & Erreur2 & ", " & Erreur3 & ", " & Erreur4 & ", " & Erreur5 & ", " & Erreur6 & ", " & Erreur7 & ", " & Erreur8 & ", " & Erreur9)
Exit Sub
End If
If Not Erreur8 = "" Then
MsgBox ("Il manque les plans" & " " & Erreur1 & ", " & Erreur2 & ", " & Erreur3 & ", " & Erreur4 & ", " & Erreur5 & ", " & Erreur6 & ", " & Erreur7 & ", " & Erreur8)
Exit Sub
End If
If Not Erreur7 = "" Then
MsgBox ("Il manque les plans" & " " & Erreur1 & ", " & Erreur2 & ", " & Erreur3 & ", " & Erreur4 & ", " & Erreur5 & ", " & Erreur6 & ", " & Erreur7)
Exit Sub
End If
If Not Erreur6 = "" Then
MsgBox ("Il manque les plans" & " " & Erreur1 & ", " & Erreur2 & ", " & Erreur3 & ", " & Erreur4 & ", " & Erreur5 & ", " & Erreur6)
Exit Sub
End If
If Not Erreur5 = "" Then
MsgBox ("Il manque les plans" & " " & Erreur1 & ", " & Erreur2 & ", " & Erreur3 & ", " & Erreur4 & ", " & Erreur5)
Exit Sub
End If
If Not Erreur4 = "" Then
MsgBox ("Il manque les plans" & " " & Erreur1 & ", " & Erreur2 & ", " & Erreur3 & ", " & Erreur4)
Exit Sub
End If
If Not Erreur3 = "" Then
MsgBox ("Il manque les plans" & " " & Erreur1 & ", " & Erreur2 & ", " & Erreur3)
Exit Sub
End If
If Not Erreur2 = "" Then
MsgBox ("Il manque les plans" & " " & Erreur1 & ", " & Erreur2)
Exit Sub
End If
If Not Erreur1 = "" Then
MsgBox ("Il manque le plan" & " " & Erreur1)
Exit Sub
End If
'End If
End Sub