Sub EnvoiMail()
Dim OutApp As Object
Dim OutMail As Object
Dim mailAddress As String
'ouvre outlook
Set OutApp = CreateObject("Outlook.Application")
'on désactive les évènements et rafraichissement-->permet d'accelerer
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
'pour chaque ligne à partir de 3 (la 2 étant les entetes)
For i = 3 To Range("A" & Rows.Count).End(xlUp).Row
'on récupère l'adresse mail
mailAddress = Range("C" & i)
Message = Range("S" & i) & " " & Range("T" & i) & "ET " & Range("U" & i)
'on crée le mail
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = mailAddress
.Subject = "Test mail"
.Body = Message
.Display 'Or use Send
End With
'on libère la mémoire
Set OutMail = Nothing
Next i
'on nettoie
Set OutApp = Nothing
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub