VBA & Macro Problems

Send Email from Excel VBA Using Outlook 365 or Outlook on the Web

Amos GikundaAmos Gikunda Nov 18, 2026 868 views

Question details

The user needs to send email from an Excel workflow using a Microsoft 365 mailbox, either through Outlook desktop or Outlook on the web.

Send Email from Excel VBA Using Outlook 365 or Outlook on the Web
Product
Microsoft Excel and Microsoft Outlook 365
Device & OS
not provided
Scenario
An Excel macro or related workflow needs to send email through a configured Microsoft 365 account.
Observed behavior
Classic Outlook desktop supports Outlook Object Model automation, while Outlook on the web cannot be controlled through the same COM interface.
Before you start

Check whether classic Outlook is installed and signed in on the computer running Excel. If you only use Outlook on the web, check that your organization allows Power Automate and the Office 365 Outlook connector.

Solution 1Recommended

Send Email with VBA and Classic Outlook Desktop

Use this approach when classic Outlook is installed and configured on the same computer as Excel.

This example uses late binding, so you do not need to add an Outlook library reference in the VBA editor. Outlook on the web and the new Outlook for Windows do not provide the classic Outlook COM automation interface used here.

1
Open the VBA editor

In Excel, open the workbook, press Alt+F11, and select Insert > Module.

2
Add the email macro

Paste this code into the module and replace the recipient and message text: Sub SendOutlookEmail() Dim outlookApp As Object Dim mail As Object Set outlookApp = CreateObject("Outlook.Application") Set mail = outlookApp.CreateItem(0) With mail .To = "recipient@example.com" .Subject = "Message from Excel" .Body = "Hello from Excel." .Send End With End Sub

3
Test the macro

In the VBA editor, place the cursor inside the macro and press F5. To review the message before sending, replace .Send with .Display, then select Send in the Outlook message window.

4
Save the workbook

In Excel, select File > Save As and choose Excel Macro-Enabled Workbook (.xlsm) to keep the VBA code.

Send Email with VBA and Classic Outlook Desktop
Outlook security prompts: Outlook security settings or organizational policies may prompt for permission or restrict automated sending.
Free Microsoft Office alternative

Work with Excel Spreadsheets in WPS Office

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface, making it easy to open and continue working with existing Excel files. It does not provide a fix for Outlook COM automation or replace the Microsoft 365 mail setup described above.

Open and edit Microsoft Excel formats such as XLSX and XLSReview spreadsheet data used in email workflowsUse a familiar interface for an easier move from Microsoft OfficeWork with documents, spreadsheets, and presentations in one suite
microsoft office alternative - wps office

Frequently Asked Questions

Can Excel VBA use CreateObject to control Outlook on the web?

No. CreateObject("Outlook.Application") uses the classic Outlook desktop COM interface. For a web-based mailbox, use a Power Automate flow or an application that calls Microsoft Graph.

How can I review an email before the macro sends it?

Replace .Send with .Display in the VBA code. Outlook opens the message so you can review it and select Send manually.

What does Microsoft Graph require to send email?

A Graph-based application needs a Microsoft Entra app registration, OAuth authentication, and the appropriate Mail.Send permission. Some organizations require administrator approval. A signed-in user's application can send through the /me/sendMail endpoint.

Why is my Excel table unavailable in Power Automate?

Check that the workbook is stored in OneDrive for Business or SharePoint and that the data is formatted as a table using Insert > Table. Then reselect the file and table in the Excel Online (Business) trigger.