You can send an email from Excel using a short VBA script that drives Outlook on your desktop. The script creates a mail item, fills in the recipient, subject and body, and either displays it for review or sends it immediately. This works on Windows with the desktop version of Outlook installed and signed in; it does not work with Outlook on the web alone, and Mac Excel needs different handling because Outlook for Mac does not expose the same automation interface. The steps below use late binding, so you do not have to add a reference to the Outlook object library, and the script will not fail to compile on a machine where Outlook is missing.
What You'll Need
- Excel for Windows (Microsoft 365 or a recent perpetual version).
- Outlook for Windows installed and signed in with the account you want to send from.
- A workbook saved as .xlsm (macro-enabled) so the code is kept.
- Macro security set to allow macros in that file, or the code will not run.
Step-by-Step
- Open the VBA editor. In Excel, press Alt+F11. If nothing happens, enable the Developer tab first: File > Options > Customize Ribbon and tick Developer in the right-hand list.
- Insert a module. In the editor, use Insert > Module. A blank code window appears. Keep your email code in a standard module, not in a sheet module, so it is easy to find and reuse.
- Paste the script. The example below sends a plain-text email with one attachment. Replace the placeholder addresses, subject and body with your own. Note that menu labels and dialog wording can differ slightly by Excel and Outlook version, device and region.
Sub SendEmail() Dim olApp As Object Dim olMail As Object Dim toAddr As String Dim subj As String Dim bodyText As String Dim attachPath As String toAddr = "recipient@example.com" subj = "Weekly report" bodyText = "Hello," & vbCrLf & vbCrLf & _ "Please find the report attached." & vbCrLf & _ "Regards" attachPath = "C:\Reports\report.xlsx" On Error GoTo Cleanup Set olApp = CreateObject("Outlook.Application") Set olMail = olApp.CreateItem(0) With olMail .To = toAddr .Subject = subj .Body = bodyText If Len(Dir(attachPath)) > 0 Then .Attachments.Add attachPath End If .Display ' use .Send to send without review End With Cleanup: Set olMail = Nothing Set olApp = Nothing If Err.Number <> 0 Then MsgBox "Email error: " & Err.Description, vbExclamation End If End Sub - Check the file path. The attachment path must be a full path that exists on the machine running the macro. A network path works only if the signed-in user has access to it. If the file is missing, the script skips the attachment rather than failing, which is why the example checks with Dir first.
- Run the macro. Press F5 in the editor, or close the editor and use Developer > Macros, select SendEmail and click Run. With .Display the message opens in Outlook for you to check before sending. With .Send it goes out immediately.
- Save the workbook. Save as .xlsm. If you save as .xlsx, Excel warns that macros will be lost and the code disappears on the next open.
- Test with your own address first. Change the recipient to your own email, run the macro and confirm the message arrives with the right subject, body and attachment before pointing it at anyone else.
Common Mistakes
- Using
.Sendwhile testing and emailing real recipients by accident. Use.Displayuntil the script is proven. - Leaving the workbook as .xlsx, so the macro is stripped on save.
- Missing the Outlook desktop app. The script needs a local Outlook profile; a browser-only mailbox will not work.
- Hard-coding a personal email address in a shared workbook. Read the address from a cell instead, for example
Range("B2").Value, so each user can set their own. - Forgetting that Outlook may show a security prompt the first time a program tries to send mail. That prompt is normal and should be allowed only if you trust the file.
- Attaching a file that is still open in Excel. Close it first, or Outlook may attach a temporary copy or fail.
Tips
- Use
.HTMLBodyinstead of.Bodyif you want bold text, line breaks or a table in the email. - Add
.CCor.BCCthe same way as.To; separate multiple addresses with semicolons. - Loop through a range of rows to send personalised messages, but add a short pause between sends so Outlook is not overwhelmed.
- Keep the recipient list in a worksheet column and check it before running, so a typo does not send the report to the wrong person.
- Store the subject and body in cells too, so non-technical users can edit the wording without opening the VBA editor.
Troubleshooting
If the macro does nothing, first check that macros are enabled for the file and that you are running the correct macro name. If you see an error about the Outlook object, confirm Outlook is installed, open and signed in, then close and reopen both Outlook and Excel. If the message opens but will not send, look at the Outlook Outbox and Sent Items to see whether it is stuck, and check that the account is connected. If the attachment is missing, verify the full path and that the file is not open elsewhere. If a security dialog blocks sending, allow it only for this trusted workbook; do not lower macro security globally. As a last resort, restart the PC, then recheck the code for a missing quote or an unclosed With block, which the editor will highlight when you compile with Debug > Compile VBAProject.
Frequently Asked Questions
Can I send email without Outlook installed?
Not with this method. The script automates the Outlook desktop application. Without it, you would need a different approach such as a mail service with an API, which is outside what VBA can do on its own.
Does this work on Mac Excel?
Not reliably. Outlook for Mac does not offer the same automation interface, so the CreateObject call usually fails. Use a Windows PC for this script.
How do I send to multiple people?
Put several addresses in the To field separated by semicolons, or loop through a range of cells and set .To for each message.
Can I add an attachment from a cell value?
Yes. Read the path from a cell and pass it to .Attachments.Add. Check the file exists first with Dir, as the example does.
Will the email send automatically when the workbook opens?
Only if you put the call in a Workbook_Open event, and that is risky because it can send before anyone reviews it. Prefer a button or a manual macro run.
Why does Outlook ask for permission the first time?
Outlook warns when another program tries to send mail. Approve it only for workbooks you trust, and never disable macro security to get around it.