Private Sub CommandButton1_Click()
On Error GoTo e_Rr:
Dim AppOut As Object
Dim oMailItem As Object
Dim NomModele As String
'NomModele = "C:\Documents and Settings\pc-maison\Bureau\MA SOCIETE\EMAIL\" & [AM2].Value
Set AppOut = CreateObject("Outlook.Application")
Derlig = Range("M:M").Find("*", , , , , xlPrevious).Row
NbLig = Range("M2:M" & Derlig).Rows.Count 'Nombre de ligne
'MsgBox (" Nombre de lignes ") & Derlig
MsgBox (" Nombre de lignes") & NbLig
For i = 2 To NbLig + 1 'a modifier pour le nombre de lignes
NomModele = ThisWorkbook.Path & "\EMAIL\" & Cells(i, "AM").Value
Set oMailItem = AppOut.CreateItemFromTemplate(NomModele)
With oMailItem
.To = Cells(i, "AE")
.Subject = "Facture N° " & Cells(i, "R")
.Attachments.Add ThisWorkbook.Path & "\FACTURE\" & Cells(i, "R").Value & ".pdf"
.Display
'.Send
End With
Next i
e_Rr:
MsgBox Err.Description, vbCritical, Err.Number
End Sub