How to Send Emails from Excel for the Web Using VBA Alternatives
Question details
The user wants to know if they can use VBA in an online Excel workbook to automatically send an email to specific recipients when certain cells meet a predefined condition.

- Product
- Excel for the Web
- Device & OS
- not provided
- Scenario
- Automating email notifications containing specific cell data whenever particular conditions (like a cell evaluating to TRUE) are met in an online workbook.
- Observed behavior
- Excel for the Web does not support or run traditional VBA macros, preventing the use of standard VBA code to trigger and send emails directly from the browser.
Before attempting to automate your workflow, confirm whether your workbook is hosted online (Excel for the Web) or saved locally, as online environments require entirely different scripting languages and tools than desktop applications.
Use Office Scripts and Power Automate
Since VBA is not supported online, you can achieve the same goal by writing an Office Script to check cell values and using Power Automate to handle the email delivery.
Office Scripts use TypeScript (a superset of JavaScript) to interact with Excel for the Web. By combining this with Power Automate, you can extract the necessary data and route it to an email action seamlessly.
Open your online workbook, navigate to the Automate tab, and select 'New Script'. Write a TypeScript function that checks if your target cell (e.g., A1) is TRUE and returns the data you wish to send (e.g., from cell C5).
Log into Power Automate and create a new automated cloud flow. Set a trigger for your flow, such as running on a specific schedule or when a file is modified.
Add a new action in your flow by searching for 'Excel Online (Business)' and selecting 'Run script'. Point it to your workbook and select the Office Script you just created.
Add another action for 'Send an email (V2)'. Use the dynamic content output from your Office Script to populate the email body and specify the recipient addresses.

Switch to Desktop Excel to Run VBA
If you are not familiar with JavaScript/TypeScript and prefer to use your existing VBA knowledge, you must open the workbook in the desktop version of Excel.
Use WPS Office to Run VBA Macros Seamlessly
If navigating Power Automate and learning TypeScript feels overwhelming, simply switch to WPS Office. WPS Spreadsheets provides powerful desktop software with full built-in VBA support, allowing you to run your traditional macros and automate emails without browser-based restrictions.
- 1. Download WPS Office: Install the free version of WPS Office on your desktop.
- 2. Open Your Workbook: Launch WPS Spreadsheets and open your .xlsm file.
- 3. Run Your Macros: Navigate to the Developer tab or press ALT + F11 to access the VBA editor and execute your email automation scripts natively.

Frequently Asked Questions
Why doesn't VBA work in Excel for the Web?
Excel for the Web operates in a browser environment, which lacks the underlying Windows COM architecture required to execute traditional Visual Basic for Applications (VBA) scripts. This is enforced for both security and cross-platform compatibility reasons.
Do I need to learn JavaScript to automate Excel online?
Yes, if you wish to write custom scripts for Excel for the Web, you will need to use Office Scripts. Office Scripts are written in TypeScript, which is a strongly typed superset of JavaScript.
Can Power Automate send emails automatically without opening the Excel file?
Yes. Once you connect an Office Script to a Power Automate flow, the automation runs in the cloud. It can evaluate your cell conditions and send emails on a schedule without requiring you to manually open the workbook.




