-
Doug Robbins - MVP 716 Reputation points
2021-10-03T03:26:52.793+00:00 See "Mail from Excel with Outlook on the following page of Ron de Bruin's web site:
Use
Option Explicit
Dim oOutlookApp As Object
Dim oItem As Object
Dim bStartApp As Boolean
Dim strSignature As String
Dim i As Long
Sub SendReminders()
Set oOutlookApp = GetObject(, "Outlook.Application")
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Application")
bStartApp = True
End If
Set oItem = oOutlookApp.CreateItem(0) 'olMailItem
With oItem
.BodyFormat = 1 'olFormatPlain
.Display
strSignature = .Body
.Delete
End With
With Sheets(1).Range("A1")
For i = 1 To .CurrentRegion.Rows.Count - 1
If .Offset(i, 10) = "Send Reminder" Then
Set oItem = oOutlookApp.CreateItem(0)
oItem.HTMLBody = "Hi " & .Offset(i, 3) & "," & vbCr & vbCr & "This is a reminder" & vbCr & vbCr & strSignature
oItem.To = .Offset(i, 11)
oItem.Subject = "Reminder"
oItem.Display
oItem.Send
End If
Next i
End With
If bStartApp = True Then
oOutlookApp.Quit
End If
Set oOutlookApp = Nothing
Set oItem = Nothing
End Sub