Automate Outlook: Send Emails with Attachments from Excel Using VBA (2025 Guide)

← PrevNext →

Last updated: 14th August 2025

Microsoft Outlook remains one of the most trusted and secure platforms for managing emails, contacts, and calendars. Whether you're working from home or in the office. Its robust features make it ideal for handling sensitive communication and streamlining productivity.

In this step-by-step guide, you'll learn how to send emails directly from Excel using VBA and Outlook. This automation technique is perfect for sending reports, alerts, or personalized messages without manually opening Outlook each time. Whether you're a beginner or an experienced Excel user, this tutorial will walk you through everything you need to know to get started.

🚀 While Microsoft Outlook allows you to send and receive emails manually, you can automate the entire process using Excel VBA macros. This powerful technique lets you generate and send emails directly from your spreadsheet—saving time and reducing errors.

Get Access to Microsoft Outlook in Excel using VBA

There are two ways you can access Outlook properties and methods using VBA in Excel.

1) You can add a reference of Outlook object in your VBA project (This is called EarlyBinding.)

Follow these steps to add a reference of the Outlook object in your VBA project

In the top menu find Tools and choose References….

In the References dialog box, find Microsoft Outlook 16.0 Object Library, click the Check-box and press OK.

Microsoft Outlook 16.0 object library reference

Note: If you are using Office 2007, add Microsoft Outlook 12.0 Object library.

2) By creating an instance of Outlook using CreateObject() method. (This is called LateBinding.)

To get access to Outlook methods and properties, you'll have to first create an instance of Outlook in VBA. Next, initialize Outlook using CreateObject().

Dim objOutlook as Object
Set objOutlook = CreateObject("Outlook.Application")

I am using the 2nd method in my example.

Remember: You must first configure Microsoft Office Outlook in your computer. Else, the code example that I am going to show you here will not produce the desired result.

Send email from Excel

Copy the macro in the Module and click the "Run" button or press F5.

Option Explicit

Private Sub send_email()

    ' Use this code if you have added a Reference of Outlook in your VBA project.
    '    Dim objOutlook As Outlook.Application
    '    Set objOutlook = Outlook.Application
    '
    '    Dim objEmail As Outlook.MailItem
    '    Set objEmail = objOutlook.CreateItem(olMailItem)

    On Error GoTo ErrorHandler

    Dim objOutlook As Object        ' Set outlook application object.
    Set objOutlook = CreateObject("Outlook.Application")
    
    ' Create email object.
    Dim objEmail As Object
    Set objEmail = objOutlook.CreateItem(0)  ' 0 = olMailItem

    With objEmail
        .To = "xyz@email.com"   ' add a real email address.
        .Subject = "This is a test message from Arun Banik"
        .Body = "Hi there"

        .Send    ' Send the message.
    End With
    
Cleanup:
    ' Release objects.
    Set objEmail = Nothing
    Set objOutlook = Nothing
    Exit Sub

ErrorHandler:
    MsgBox "Error occurred: " & Err.Description, vbCritical
    Resume Cleanup
End Sub

Once the macro runs successfully, Outlook will automatically send an email with the specified subject line and a simple message body that says "Hi there".

Object Initialization Explained

To automate email sending from Excel using VBA, I’ve created two key objects: objOutlook and objEmail.

1) objOutlook – Outlook Application Object

• Initialized using CreateObject("Outlook.Application").
• This object gives access to Outlook’s core functionality.
• Once created, it allows you to generate new email items using the CreateItem() method.

2) objEmail – Mail Item Object

• Created via objOutlook.CreateItem(0) where 0 represents a standard mail item (olMailItem).

• This object lets you set email-specific properties such as:
.To – recipient address
.Subject – email subject line
.Body – message content

Using .Display property to display message before sending email

Another useful feature is the ability to preview your email in Outlook before it's sent. By replacing the .Send method with .Display, you can open the email window and review details like the subject, body, recipients, and attachments. This gives you a chance to make final edits or confirmations before hitting send.

With objEmail
    .To = "xyz@email.com"
    .Subject = "This is a test message from Arun Banik"
    .Body = "Hi there"
    ' .Send
    .Display   		' Opens the email in Outlook for review.
End With

Add Attachments, CC and BCC in Excel

Similarly, you can test with other important properties such, CC, BCC, Attachments etc.

attachmentPath = "e:\report.doc"    ' Update path as needed.
With objEmail
    .To = "xyz@email.com"
    .CC = "arun@mail.com"
    .BCC = "arun@hotmail.com"
    .Subject = "This is a test message from Arun"
    .Body = "Hi there"
    ' Add attachment if file exists.
    If Dir(attachmentPath) <> "" Then
        .Attachments.Add attachmentPath
    Else
        MsgBox "Attachment not found: " & attachmentPath, vbExclamation
    End If
    .Send
End With
Conclusion

You've just unlocked a powerful productivity hack, automating emails directly from Excel using VBA and Outlook. Whether you're sending reports, reminders, or personalized messages, this technique can save you hours of manual work and reduce the chance of errors.

We covered:
1) How to initialize Outlook and create email objects
2) Adding recipients, subject lines, and message bodies
3) Previewing emails before sending
4) Including CC, BCC, and file attachments

But this is just the beginning. VBA gives you the flexibility to customize emails based on Excel data, schedule messages, and even trigger alerts based on conditions. So go ahead, experiment with other properties, loop through rows, and build macros that make your workflow smarter.

← PreviousNext →