How to Send Outlook Emails from a Shared Mailbox Using Excel VBA
Question details
The user needs to automate the process of sending emails via Microsoft Outlook using a designated shared mailbox account, directly triggered from an Excel VBA macro.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Automating bulk email dispatch from a shared team or department Outlook mailbox based on recipient data, subjects, and attachment paths stored in an Excel spreadsheet.
- Observed behavior
- A customized VBA macro references the Microsoft Outlook Object Library to read spreadsheet columns and successfully sends emails using the specified shared account via the SendUsingAccount property.
Ensure that you have Microsoft Outlook installed on your computer and configured with the shared mailbox account. You must also verify that you have 'Send As' or 'Send on Behalf' permissions for the shared mailbox in Microsoft 365.
Create a VBA Macro to Send Emails via a Shared Mailbox
Use this method to enable the Microsoft Outlook Object Library and run a script that specifies the sending account using the Outlook.Account object.
This approach relies on the Outlook.Account object to select the correct sending address specified in an Excel column. It reads recipient data, subjects, message bodies, and attachment paths directly from the worksheet rows to construct and dispatch the emails.
In Excel, press Alt + F11 to open the VBA Editor. In the top menu, click on Tools > References. Scroll down the list, check the box next to 'Microsoft Outlook Object Library' (the version number may vary), and click OK to save the change.
Set up your Excel sheet so that the macro knows where to pull data from. For example, place Recipient addresses in Column A, CC addresses in Column B, Subjects in Column C, Body text in Column D, full Attachment file paths in Column E, and the exact Shared Mailbox Email Address in Column G.
In the VBA Editor, insert a new module (Insert > Module) and write your script. Ensure you declare the 'OutAccount' as an Outlook.Account and set it using 'OutApp.Session.Accounts.Item(SharedMailboxAddress)'. Bind this account to the mail item by adding '.SendUsingAccount = OutAccount' within your email generation loop.
Run the macro to process the rows. Use the '.Display' method in your code instead of '.Send' to preview the drafted emails first. Once you have verified that the correct sending account, recipients, and attachments are applied, switch '.Display' to '.Send' to automate the delivery.

How to Run VBA Macros and Automate Emails in WPS Spreadsheet
WPS Spreadsheet fully supports VBA macros, allowing you to run the exact same Outlook automation scripts as Microsoft Excel. With its built-in developer tools, you can easily integrate your spreadsheet data with Outlook.
- 1. Enable Developer Tools: Open your worksheet in WPS Spreadsheet. Go to the 'Developer' tab on the top ribbon. If VBA is not active, ensure you have downloaded the VBA module for WPS Office.
- 2. Open the VBA Editor: Click on 'Visual Basic' or press Alt + F11 to launch the VBA Editor within WPS Spreadsheet.
- 3. Add the Outlook Reference: Navigate to Tools > References in the VBA Editor, locate 'Microsoft Outlook Object Library', check the box, and click OK.
- 4. Execute the Code: Insert a new module, paste your email automation script, and click 'Run' (or press F5) to start drafting or sending your emails via Outlook.

Frequently Asked Questions
Why does the macro return an 'Invalid sending account' error?
This error occurs if the shared mailbox address specified in your Excel column does not perfectly match an account configured in your local Outlook application, or if you lack the necessary 'Send As' permissions for that shared mailbox.
How do I automatically attach a file to the Outlook email using VBA?
You can specify the full file path of the document in a dedicated column (e.g., Column E). In your VBA script, use the '.Attachments.Add' method followed by the cell value containing the file path to attach it to the email item.
Can I use this VBA script without opening Outlook?
The Microsoft Outlook Object Library requires the Outlook desktop application to be installed and properly configured on your device. However, as long as Outlook is configured in the background, the VBA script can create and send emails without requiring you to manually open the Outlook user interface.




