Send emails using excel list
You can send emails using an Excel list by using a combination of Excel formulas and VBA macros. Here's a step-by-step guide to help you achieve this:
Method 1: Using Excel Formulas
- Create a new Excel sheet with the following columns:
- Email Address
- Subject
- Body
- Attachment (optional)
- Enter the email addresses, subject, and body in the respective columns.
- Use the
CONCATENATE
function to combine the email address, subject, and body into a single string. For example:=CONCATENATE(A2,"Subject: ",B2,"Body: ",C2)
=CONCATENATE(A2,"Subject: ",B2,"Body: ",C2,"Attachment: ",D2)
- Use the
MAILTO
function to send the email. For example:=MAILTO(A2,"Subject: ",B2,"Body: ",C2)
=MAILTO(A2,"Subject: ",B2,"Body: ",C2,"Attachment: ",D2)
- Select the cell with the
MAILTO
function and press Enter to send the email.
Method 2: Using VBA Macros
-
Open the Visual Basic Editor by pressing
Alt + F11
or by navigating toDeveloper
>Visual Basic
in the ribbon. -
Create a new module by clicking
Insert
>Module
in the Visual Basic Editor. -
Paste the following code into the module:
Sub SendEmails() Dim ws As Worksheet Set ws = ThisWorkbook.Worksheets("YourSheetName") Dim i As Long For i = 2 To ws.Cells(ws.Rows.Count, "A").End(xlUp).Row Dim email As String email = ws.Cells(i, "A").Value Dim subject As String subject = ws.Cells(i, "B").Value Dim body As String body = ws.Cells(i, "C").Value Dim attachment As String attachment = ws.Cells(i, "D").Value Dim olApp As Object Set olApp = CreateObject("Outlook.Application") Dim olMail As Object Set olMail = olApp.CreateItem(0) With olMail .To = email .Subject = subject .Body = body If attachment <> "" Then .Attachments.Add attachment End If .Send End With Set olMail = Nothing Set olApp = Nothing Next i End Sub
-
Replace
"YourSheetName"
with the name of your Excel sheet. -
Save the module by clicking
File
>Save
(or pressCtrl + S
). -
Go back to your Excel sheet and select the cell range that contains the email addresses, subject, body, and attachment.
-
Press
Alt + F8
to open the Macro dialog box, select theSendEmails
macro, and clickRun
.
Tips and Variations
- You can modify the code to send emails in batches or to specific folders.
- You can use the
Range
object to select the cell range instead of hardcoding the sheet name. - You can use the
Outlook.Application
object to send emails with attachments. - You can use the
MailItem
object to customize the email properties, such as the sender, reply-to, and CC.
Remember to test the code and macros in a controlled environment before sending emails to a large number of recipients.