Might require some editing to completely fit your needs
'
Option Explicit
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub SendMultipleEmails()
On Error Resume Next
Dim Mail_Object, OutApp As Variant, lastRow As Variant
Dim i As Integer
Dim sht As Sheet1
Set sht = ThisWorkbook.Worksheets("Sheet1")
lastRow = sht.Cells(sht.Rows.Count, "A").End(xlUp).Row
For i = 2 To lastRow
Set Mail_Object = CreateObject("Outlook.Application")
Set OutApp = Mail_Object.CreateItem(0)
With OutApp
.Subject = "Testing MultiEmails"
.Body = "Hello TEST !"
.To = Cells(i, 1).Value
.Attachments.Add Cells(i, 2).Value
.send
End With
If i = lastRow Then
GoTo Done
Else
Calculate
Sleep (5000) ' delay 1 second
End If
Next i
debugs:
If Err.Description <> "" Then MsgBox Err.Description
Done:
MsgBox "All emails have been sent. "
End Sub
Bookmarks