1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Sub test()
Dim w1 As Worksheet
Dim i As Long
Dim D As Date
Dim M As Object, OlApp As Object, Destinataire As String
Application.ScreenUpdating = False
D = Date
Set w1 = Worksheets("Feuil1")
For i = 2 To w1.Range("A" & Rows.Count).End(xlUp).Row
On Error Resume Next
If w1.Cells(i, "K") = D Or w1.Cells(i, "M") = D Then
w1.Cells(i, "N") = "Email Envoyé"
Set OlApp = CreateObject("Outlook.application")
Set M = OlApp.CreateItem(olMailItem)
With M
.Subject = "Texte à saisir : votre texte personnalisé "
.Body = w1.Cells(i, "A")
.Recipients.Add "aaaaaa_abd@yahoo.fr;" & "bbbbb_abd@yahoo.fr;" & "bcccc_abd@yahoo.fr"
.Send
End With
End If
Next i
Application.ScreenUpdating = True
End Sub |
Partager