logo
search
Office Settings & Configuration

How to Specify the Sending Account in Outlook VBA | Access to Outlook

Algirdas JasaitisAlgirdas Jasaitis Oct 9, 2026 869 views

Question details

The user needs to know how to programmatically select a specific sender account when creating and sending an Outlook email from Microsoft Access VBA.

How to Specify the Sending Account in Outlook VBA
Product
Microsoft Outlook and Access
Device & OS
not provided
Scenario
Automating email creation in Access VBA when multiple Outlook accounts are configured, requiring the script to choose an account other than the default.
Observed behavior
By default, Outlook VBA uses the primary account to send emails. The user must find a way to specify a different configured account or a shared mailbox before the email is sent.
Before you start

Ensure you have added the 'Microsoft Outlook Object Library' reference in your Access VBA editor (Tools > References) to access early-bound Outlook objects and properties.

Solution 1Recommended

Use SendUsingAccount to Select a Specific Configured Account

Iterate through your configured Outlook accounts and assign the matching Outlook.Account object to the SendUsingAccount property.

When multiple accounts are configured in Outlook, sending an email via Access VBA defaults to the primary account. To change this, you must assign a valid Outlook.Account object to the MailItem.SendUsingAccount property.

1
Initialize the Outlook Application

Create an instance of the Outlook Application and a new MailItem object in your Access VBA module.

2
Loop Through Session Accounts

Use a 'For Each' loop to iterate over the `Application.Session.Accounts` collection to evaluate all available accounts.

3
Match and Assign the Account

Compare each account's SmtpAddress with your desired sender email address. Once found, set `MailItem.SendUsingAccount` to that specific account object before displaying or sending the email.

Use SendUsingAccount to Select a Specific Configured Account
Important Object Requirement: You cannot simply assign a string of the email address to SendUsingAccount; it must be a valid Outlook.Account object.
Free Microsoft Office alternative

Looking for a Fast and Reliable Office Alternative?

If you frequently work with automation, VBA, and data integration, you understand the value of a powerful office suite. WPS Office provides excellent compatibility with Microsoft Word, Excel, and PowerPoint files while offering a lightweight, cost-effective alternative for your daily document needs.

  1. 1. Download WPS Office: Visit the official WPS website and download the free installation package.
  2. 2. Install the Suite: Run the installer and follow the on-screen instructions to set up WPS Office on your device.
  3. 3. Open and Edit Files: Launch WPS Office to seamlessly open, edit, and save your existing Microsoft Office documents.
Fully compatible with Microsoft Office formats (.docx, .xlsx, .pptx)Familiar and intuitive user interface for a zero-learning-curve migrationLightweight installation with rapid launch speedsCost-effective solution with built-in PDF editing capabilities
microsoft office alternative - wps office

Frequently Asked Questions

Why do I get a Type Mismatch error when setting SendUsingAccount?

This usually occurs if you try to assign a text string of the email address instead of an Outlook.Account object. You must iterate through Application.Session.Accounts to find and assign the actual object variable.

Can I use SentOnBehalfOfName without delegate permissions?

No. Your Exchange administrator must grant your primary authenticated account 'Send As' or 'Send on Behalf' permissions for the target address. Without these permissions, the email will bounce back or remain stuck in the Outbox.

How can I check which Outlook accounts are available via VBA?

You can write a quick VBA macro to loop through `Application.Session.Accounts` and use `Debug.Print` to output the `SmtpAddress` or `DisplayName` of each configured account to the Immediate Window in the VBA editor.