Sending Emails With VBA: Excel and Outlook Guide

VBA & macros · Updated November 18, 2026

Yes—Excel VBA can create and send email through classic Outlook for Windows. In Excel, add a macro that creates an Outlook mail item, fills in its recipient and message, then uses .Display to review it or .Send to send it; the example below opens a draft first.

How Excel VBA sends an email

VBA does not send a message by itself. A macro can ask another application or service to do the sending. A common Windows setup uses Excel VBA to automate classic Outlook: Excel creates an Outlook message, sets its fields, and tells Outlook to display or send it. Outlook then uses an account configured in Outlook to handle delivery.

This distinction matters because a macro that successfully creates a message has not necessarily delivered it. Outlook may be offline, the account may need attention, the recipient may be invalid, or the message may remain open as a draft. Using .Display lets a person inspect the message and press Send. Using .Send hands it to Outlook without opening the draft window, but it does not guarantee that the recipient receives it.

The code in this guide is for Excel for Microsoft 365 on Windows with classic Outlook installed and configured. It uses late binding, meaning the macro does not require you to add an Outlook reference in the VBA editor. That makes it simpler to share between many Windows installations, although it does not make the code compatible with every Outlook app.

Set up the workbook and Outlook

  1. Confirm that classic Outlook is installed and that you can send a normal message from it. The code relies on Outlook being available on the same Windows computer.
  2. In Excel, save a working copy as an Excel Macro-Enabled Workbook (.xlsm) using File > Save As. A regular .xlsx file cannot store VBA macros.
  3. Open the Visual Basic Editor with Alt+F11, choose Insert > Module, and paste the macro into the module.
  4. Change the recipient, subject, and message in the code, or adapt it to read values from cells. Run it with F5 from the editor or close the editor and use Alt+F8 to select the macro.

On a Mac, Excel has a VBA editor, but the Windows example below depends on Windows COM automation and will not work as written. Excel for the web can store a macro-enabled workbook but cannot run VBA. Do not treat those environments as interchangeable; the sending method needs to match the operating system and mail client.

A basic Excel VBA email macro

This example reads a recipient address from cell B2 on a worksheet named Sheet1, builds a plain-text message, and opens it in classic Outlook for review. Make sure the sheet name and cell reference match your workbook. Save a copy of the workbook before running any macro: VBA changes cannot be undone with Ctrl+Z.

Sub CreateEmailFromExcel()
    Dim OutlookApp As Object
    Dim MailItem As Object
    Dim Recipient As String

    On Error GoTo EmailError

    ' Read the recipient from the worksheet.
    Recipient = Trim$(ThisWorkbook.Worksheets("Sheet1").Range("B2").Value)

    If Len(Recipient) = 0 Then
        MsgBox "Enter a recipient address in Sheet1 cell B2."
        Exit Sub
    End If

    ' Connect to classic Outlook, or start it if necessary.
    Set OutlookApp = CreateObject("Outlook.Application")
    Set MailItem = OutlookApp.CreateItem(0)

    With MailItem
        .To = Recipient
        .Subject = "Monthly report"
        .Body = "Hello," & vbCrLf & vbCrLf & _
                "Please review the monthly report." & vbCrLf
        .Display  ' Review the draft before sending.
    End With

CleanUp:
    Set MailItem = Nothing
    Set OutlookApp = Nothing
    Exit Sub

EmailError:
    MsgBox "Outlook could not create the message: " & Err.Description
    Resume CleanUp
End Sub

To send without opening a draft, replace .Display with .Send after you have tested the macro and confirmed the addressing and content. A safer workflow is to keep .Display while building and validating the process. If Outlook is not installed or the required automation interface is unavailable, CreateObject will fail and the error handler will show a message.

Customize recipients, message text, and attachments

Outlook mail items expose fields such as .To, .CC, .BCC, .Subject, and .Body. You can assign more than one recipient as a semicolon-separated string, or set fields from worksheet cells. For example, a report sheet might hold an address in B2, a subject in B3, and message text in B4. Validate those cells before creating the message: blank addresses, stray spaces, and unintended text can lead to confusing drafts or delivery failures.

For formatted messages, use .HTMLBody instead of .Body and supply valid HTML markup. HTML gives control over paragraphs, links, and simple formatting, but it also makes it easier to create malformed or hard-to-read messages. Keep a plain-text version of important information in mind, and preview the result in Outlook before sending.

An attachment can be added with a line such as .Attachments.Add ThisWorkbook.FullName, provided the workbook has been saved and the intended file is the workbook itself. That line can expose every sheet and item in the file, including hidden data. If the recipient should receive a separate report, create and check that file first, then attach its full path instead. Check that the path exists and that the attachment is the correct version before sending.

Sending messages to a list in Excel

A common next step is to read one address per row and create a message for each person. A loop can take the address from a column, personalize the subject or body with values from that row, and create a mail item. For a first run, use .Display and a small test list. Confirm that each message has the intended recipient and content before changing the macro to send automatically.

Decide whether each row represents a separate private message or whether several people should receive one shared message. Separate messages avoid exposing a recipient list to everyone, while a single message with many addresses may be appropriate for a genuine group conversation. For individual mail merges, avoid placing a whole list in the To field if recipients should not see one another’s addresses.

Large or repeated batches need more care than a one-off email. Mail providers and organizations can impose sending limits, and unusual volume can trigger spam controls or account restrictions. VBA should not be used to evade those controls. Confirm that recipients expect the messages, include an appropriate way to handle replies, and follow your organization’s policies. For regular high-volume communication, use an approved mailing or transactional email service rather than treating Outlook as a bulk-mail platform.

Common problems and what they mean

  • “ActiveX component can’t create object” or a similar automation error: Excel cannot create the Outlook automation object. Check that classic Outlook is installed and available, and remember that the new Outlook for Windows does not provide the same COM automation interface used by this example.
  • The macro opens a message but does not send it: That is expected when the code uses .Display. The user must review the draft and click Send. If the macro uses .Send, check Outlook’s Outbox, connection state, account configuration, and any error messages.
  • A security warning appears: Outlook may apply programmatic access protections to automated sending, depending on its version, security configuration, and the status of antivirus software. Do not try to defeat a warning by weakening protections; ask an administrator about approved configuration.
  • Excel says macros are disabled: Files from the internet or other untrusted locations may be blocked. Enable macros only for a workbook you trust and understand. Do not turn on all macros globally just to run an unfamiliar file.
  • The message has broken formatting: Plain-text .Body does not interpret HTML. Use .HTMLBody for HTML and inspect the message in Outlook, or keep the content plain text.

For macro settings in Excel for Windows, the relevant controls are under File > Options > Trust Center > Trust Center Settings > Macro Settings. Settings may be controlled by an organization’s administrator. Prefer a trusted, reviewed workbook or an approved digital-signature process over enabling every macro.

Classic Outlook, new Outlook, and other options

“Outlook” can refer to different Windows applications. This example automates classic Outlook through its COM interface. The new Outlook for Windows does not support that same Outlook Object Model automation, so installing or switching to the new app does not make this macro work. If your organization is moving to new Outlook, ask IT which supported sending method it permits before building a workflow around COM.

Excel for the web does not run VBA. On Mac, Outlook and Excel do not offer the Windows COM automation path in this example, so a Mac workflow needs a different approach. Office Scripts can automate some Excel tasks in supported Microsoft 365 environments, but Office Scripts are not a drop-in VBA replacement for automating Outlook desktop.

For a Windows desktop task that creates a few messages, classic Outlook automation can be convenient if it is already installed and permitted. For a process that must run unattended, work across platforms, or send messages at scale, consider an organization-approved service such as Microsoft Graph or a workflow platform. Those options require their own setup, permissions, and security review; they are not simply a different line of VBA.

Safety and reliability before sending

Email automation can disclose information quickly, so treat the workbook and macro as part of the sending system. Test with your own address first, inspect the generated message, and verify that the account shown in Outlook is the account you intend to use. If a macro is designed to send automatically, consider adding a confirmation step, a maximum batch size, and a log of the intended recipients and outcomes.

Keep recipient data accurate and limit access to the workbook. Avoid storing passwords in VBA: code in a workbook is not a secure secret store. If the message contains confidential material, check the recipient, attachment, and sharing rules before sending. A macro can automate clicks, but it cannot decide whether a disclosure is authorized or whether a message complies with organizational policy.

Frequently Asked Questions

Can Excel VBA send an email without Outlook?
Not with the Outlook automation method shown here: it requires classic Outlook on Windows. Other routes, such as a web service or Microsoft Graph, use different APIs, permissions, and setup and should be selected to meet the organization’s requirements.

Will this macro work with the new Outlook for Windows?
No, not as written. It uses the COM automation interface associated with classic Outlook, which the new Outlook for Windows does not support in the same way.

Can I send an email from Excel for the web?
Excel for the web cannot execute VBA macros. You need desktop Excel for VBA, or a separate supported automation approach that fits your Microsoft 365 environment.

How do I add an attachment?
Add an .Attachments.Add line to the mail item’s With block and provide the full path to an existing file. Confirm the file is the intended one, and check for sensitive or hidden workbook content before attaching it.

Can VBA send an email automatically?
Yes. In this Outlook-based example, .Send submits the message through Outlook without opening its draft window. Test carefully first; security prompts, account state, provider limits, and organizational rules can affect automated sending.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.