Sub testJP()
Dim IE As Object
Dim IEdoc As Object
Dim DOCelement As Object, FrameLeftDoc As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate ("XXXXXXXXXXXXXXX")
WaitIE IE
Set IEdoc = IE.document
Set FrameLeftDoc = IEdoc.frames("leftframe").document
Set DOCelement = FrameLeftDoc.all("M21")
DOCelement.Click
WaitIE IE
Set IEdoc = IE.document
Application.Wait Now() + TimeValue("00:00:01")
Set FrameLeftDoc = IEdoc.frames("leftframe").document
'Application.Wait Now() + TimeValue("00:00:5")
Set DOCelement = FrameLeftDoc.all("A9")
DOCelement.Click
WaitIE IE
If Cells(1, 1) Then L = 0
L = L + 1
With DOCelement
Set DOCelement = IEdoc.getElementsByName("A3").Item
DOCelement.Value = Cells(L, 1).Text
Set DOCelement = IEdoc.getelementsbytagname("button")(12)
DOCelement.Click
End With
If Cells(L + 1, 1) <> "" Then MsgBox ("Traitement terminé !")
Set IE = Nothing
End Sub