In Excel: paste Sub SendEmailOutlook() into the VBA editor (Alt + F11 → Insert ▸ Module), press F5 to run, and save as .xlsm to keep the macro. Excel for the web cannot create, run, or edit VBA macros. Open the workbook in the Excel desktop app to work with macros.
On this page8
VBA macro: Send Email via Outlook
Sub SendEmailOutlook()
Dim olApp As Object
Dim olMail As Object
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(0) ' 0 = olMailItem
With olMail
.To = "recipient@example.com"
.Subject = "Report from Excel"
.Body = "Please find the report attached."
.Attachments.Add ThisWorkbook.FullName
.Send ' Use .Display to preview before sending
End With
Set olMail = Nothing
Set olApp = Nothing
MsgBox "Email sent via Outlook.", vbInformation
End SubUses late binding (CreateObject) so no reference needs to be set in Tools ▸ References. Replace .Send with .Display to open the draft for review before sending.
How to run this macro
- Press Alt + F11 to open the VBA editor.
- Insert > Module.
- Paste the code above.
- Press
F5, or close the editor and run it from Developer > Macros. - Save the file as .xlsm so the macro is kept.
Open Excel and navigate to Developer ▸ Visual Basic (or press Alt + F11).
Select Insert ▸ Module from the menu bar inside the VBA editor.
Copy and paste Sub SendEmailOutlook() into the Module.
Click anywhere inside the Sub body and press F5 to run.
Close the VBA editor and save the file as .xlsm.
What this does
Pasting Sub SendEmailOutlook() into Excel's VBA editor gives you a one-click solution to send an email from Excel using Outlook VBA. The macro runs inside the Visual Basic for Applications (VBA) environment, which lets it loop over entire sheets, inspect every cell, and take action faster than any manual workflow. Open the editor with Alt + F11, insert a new Module, paste the code, and run it — the Send Email via Outlook task completes automatically. Save the file as .xlsm (macro-enabled workbook) so the Sub is preserved when you close and reopen Excel. A macro runs in the desktop app's VBA environment, not in the cell grid: the workbook has to be saved in a macro-enabled format such as .xlsm to keep the code, and your macro security settings — or a file that arrived from the internet — can block it until you trust it. Excel for the web cannot run VBA at all. For “excel vba to send email”, the reliable version is a short checking loop, not just the first command that appears to work. Run it on a deliberately small range first, watch how the affected cells change, and only then apply the same setup to the full sheet. When this is a ribbon command, the selection matters more than the button: confirm the range, apply the command, then spot-check the output before saving. That is what makes a workflow that saves repeating the same clicks every week useful in real work: repeatable, auditable, and not dependent on memory or luck.
A worked example
Example: a colleague sends you a large dataset and asks you to send an email from Excel using Outlook VBA before handing it back. Open the VBA editor with Alt + F11, create a new Module, paste the Sub SendEmailOutlook() code, and click Run (or press F5). Excel calls the Sub, runs through the sheet, and finishes the Send Email via Outlook task automatically. The whole operation takes seconds regardless of how many rows are involved — and because the macro is deterministic, it will produce the same result every time you run it on the same input. Reach for the Send Email via Outlook macro whenever send an email from Excel using Outlook VBA is a task you repeat more than once, involves more than a handful of rows, or needs to be done consistently across multiple workbooks. VBA runs in milliseconds over data that would take minutes by hand, and it never makes the selection mistakes that manual workflows introduce when fatigue sets in. If the macro will be shared, add a comment at the top saying what it changes and which sheet it expects, and keep the workbook as .xlsm — saving it as .xlsx removes the code.
In Google Sheets
Google Sheets does not run VBA. A macro written for Excel has to be rewritten in Google Apps Script (Extensions ▸ Apps Script), and an .xlsm file converted to Sheets keeps its cells but drops the code. Nothing on this page is behind a login or a download: the exact answer is at the top, and the detail below it is there for when you need it. That is the whole promise here — the answer first, and just enough context to make it stick. For “excel vba to send email”, the checks are about the environment as much as the code: desktop Excel with macros enabled for this file, a macro-enabled workbook and a saved copy to fall back on. Run it once on test data, compare the result with what the code says it does, and only then run it on the real sheet.
Common mistakes
- Saving as .xlsx instead of .xlsm — Excel strips all VBA code when you save in the non-macro-enabled format. Always choose "Excel Macro-Enabled Workbook (.xlsm)" from the Save As dialog.
- Running the macro on the wrong sheet — Sub SendEmailOutlook() acts on ActiveSheet by default. If you have multiple sheets open, click the correct sheet tab first before pressing Run.
- Macros are disabled — if you see a security warning bar, click Enable Content. If there is no bar at all, set File ▸ Options ▸ Trust Center ▸ Trust Center Settings ▸ Macro Settings to "Disable VBA macros with notification", which is the safe default that still lets you approve a file per workbook. Do not select "Enable all macros": it removes the only warning you get before a hostile workbook executes.
Frequently asked questions
How do I run the Send Email via Outlook macro?
Press Alt + F11 to open the VBA editor, insert a Module (Insert ▸ Module), paste Sub SendEmailOutlook() into the code pane, and press F5. Alternatively close the editor and run it from Developer ▸ Macros ▸ select "SendEmailOutlook" ▸ Run.
Why won't my macro run — macros are disabled?
Excel blocks macros by default for files downloaded from the internet. Click the yellow security bar and choose "Enable Content" — that trusts this one workbook and is all that is normally needed. Leave File ▸ Options ▸ Trust Center ▸ Trust Center Settings ▸ Macro Settings on "Disable VBA macros with notification" rather than switching to "Enable all macros", which Microsoft itself marks not recommended. If the bar is red instead of yellow, the file carries Mark of the Web: close Excel, right-click the file, open Properties and tick Unblock. Also ensure the file is saved as .xlsm, not .xlsx.
Can I undo what the Send Email via Outlook macro did?
No — VBA actions generally cannot be undone with Ctrl+Z because they bypass Excel's undo stack. Always test Sub SendEmailOutlook() on a backup copy of the workbook before running it on live data, or add explicit validation logic inside the macro before the destructive step.
Other ways people ask this
This is also commonly searched as “send email with excel vba” and “vba excel send email”. They describe the identical operation, so you are in the right place no matter how you phrased it.
Why do people search for this in so many different ways?
Because the same task has many names. “send email with excel vba”, “vba excel send email” all point at the one operation explained on this page, which is why they all lead here.