How to Send Outlook Emails from Excel VBA When a Cell Changes
Question details
The user wants to automatically send an Outlook 365 email to multiple recipients when a specific cell's value changes from blank to 'Create'.

- Product
- Microsoft Excel / WPS Spreadsheet
- Device & OS
- not provided
- Scenario
- Automating email notifications, such as invoice alerts, based on real-time spreadsheet data updates.
- Observed behavior
- A VBA script must be implemented using a change event to trigger the Outlook email creation, ensuring it includes a defined subject, body, and link.
Ensure that Microsoft Outlook is installed and configured with an active email account on your computer, and verify that macros are enabled in your workbook.
Use the Worksheet_Change Event to Trigger an Email
Implement a VBA macro that monitors a specific column and triggers an Outlook email creation when the target text is entered.
To accomplish this, you must use the Worksheet_Change event directly inside the specific sheet's module rather than a standard module. This code uses Late Binding to create the Outlook object, meaning you do not need to manually enable reference libraries.
Press ALT + F11 on your keyboard to launch the Visual Basic for Applications (VBA) editor.
In the Project Explorer pane on the left, double-click the specific worksheet (e.g., Sheet1) where you want to monitor the cell changes in column G.
In the code window, paste a `Private Sub Worksheet_Change(ByVal Target As Range)` procedure. Add a condition check like `If Target.Column = 7 And Target.Value = "Create" Then` to restrict the trigger to column G only.
Within the IF statement, initialize the email using `Set OutApp = CreateObject("Outlook.Application")` and `Set OutMail = OutApp.CreateItem(0)`.
Define your recipients, subject, and message body using `.To`, `.Subject`, and `.Body` (or `.HTMLBody` for links). Conclude the block with `.Display` to review the draft, or `.Send` to dispatch it immediately.

Run VBA Macros Seamlessly in WPS Spreadsheet
WPS Spreadsheet offers powerful compatibility with Microsoft Excel VBA macros. You can easily write, test, and execute scripts to automate your workflow, including sending automated emails via Outlook.
- 1. Open your Workbook in WPS Spreadsheet: Launch WPS Office and open your .xlsm macro-enabled workbook containing the notification data.
- 2. Access the Developer Tools: Navigate to the 'Developer' tab on the ribbon and click on 'Visual Basic' or simply press ALT + F11 to open the editor.
- 3. Paste and Run Your Macro: Insert your Worksheet_Change VBA code in the relevant sheet module, save the workbook, and test the target cell to trigger your Outlook email.

Frequently Asked Questions
Why doesn't my Worksheet_Change macro run when I type 'Create'?
Macros might be disabled in your Trust Center settings, or you may have accidentally disabled background events. You can re-enable events by typing `Application.EnableEvents = True` into the Immediate Window of the VBA editor and pressing Enter.
Can I format the email body with HTML instead of plain text?
Yes. Instead of using `.Body` in your VBA script, use the `.HTMLBody` property. This allows you to include standard HTML tags for text formatting, line breaks (<br>), and clickable hyperlinks.
How do I send the email to multiple recipients?
In your VBA code, you can assign multiple email addresses to the `.To` or `.CC` properties by separating each address with a semicolon (;). For example: `.To = "user1@example.com; user2@example.com"`.
Do I need Outlook installed on my computer for this macro to work?
Yes, this specific VBA method relies on the `Outlook.Application` COM object. It requires the desktop version of Microsoft Outlook to be installed and logged into an active email account on the device running the script.




