Assuming you have headers:
A1: Employee Name
B1: Employee Email
C1: Subject
D1: Salutation
E1: Body
You can use this:
Sub SendMail()
Dim OutApp As Object, OutMail As Object
Dim Body As String, Subject As String, Salutation As String, EmployeeName As String, EmployeeEmail As String
Dim LastEmployee As Long, Employee As Long
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
LastEmployee = ActiveSheet.Range("A" & ActiveSheet.UsedRange.Rows.Count + 2).End(xlUp).Row
If LastEmployee = 1 Then
MsgBox ("No Employees in List")
Application.ScreenUpdating = True
Exit Sub
End If
Subject = Range("C2").Value
Salutation = Range("D2").Value
Body = Range("E2").Value
For Employee = 2 To LastEmployee
EmployeeName = Cells(Employee, 1)
EmployeeEmail = Cells(Employee, 2)
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = EmployeeEmail
.Subject = Subject
.Body = Salutation & " " & EmployeeName & "," & vbNewLine & vbNewLine & Body
.Send
End With
Set OutMail = Nothing
Next Employee
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
Bookmarks