VBA & Macro Problems

How to Send Email from an Access Form Using Outlook VBA

Muhammad TalhaMuhammad Talha Nov 2, 2026 869 views

Question details

The user needs to automate sending Outlook emails from a Microsoft Access form using VBA while ensuring code compatibility across different Outlook versions.

How to Send Email from an Access Form Using Outlook VBA
Product
Microsoft Access / Microsoft Outlook
Device & OS
not provided
Scenario
Automating email sending from an Access database form across multiple computers with different Outlook versions, raising concerns about library compatibility and security prompts.
Observed behavior
Using early binding causes object-library compatibility errors on different machines, and basic methods like SendObject trigger Outlook security prompts that interrupt the automation flow.
Before you start

Ensure you have basic knowledge of VBA programming and that Microsoft Outlook is installed and configured with an active email account on the target computers.

Solution 1Recommended

Use Late Binding with Outlook Automation

This method avoids hardcoding a specific Outlook version reference, making your VBA code compatible across different computers and Outlook versions.

Late binding involves declaring Outlook objects as generic Object variables and instantiating them using the CreateObject function. This prevents compile-time errors when running the Access database on machines with different versions of Outlook installed, bypassing the need to check specific Object Library references.

1
Declare Generic Object Variables

In your VBA editor, declare your Outlook application and mail item variables as generic Objects (e.g., `Dim objOutlook As Object`, `Dim objMail As Object`) instead of specific Outlook application types.

2
Instantiate the Outlook Application

Use the CreateObject function to launch or connect to the active Outlook session by typing: `Set objOutlook = CreateObject("Outlook.Application")`.

3
Create and Send the Email

Create the mail item using `Set objMail = objOutlook.CreateItem(0)`. Populate the `.To`, `.Subject`, and `.Body` properties using data from your Access form's text boxes, then execute the `.Send` or `.Display` method.

Use Late Binding with Outlook Automation
Handling Outlook Security Prompts: Even with automation, Outlook may display a security warning when an external program tries to send an email. To suppress this, you typically need to configure a trusted administrative setup in Windows Security Center or use third-party security bypass tools.
Free Microsoft Office alternative

Discover WPS Office for Your Productivity Needs

While Microsoft Access and Outlook require paid subscriptions, you can handle most data management and automation tasks with WPS Office. WPS Spreadsheet supports VBA and Macros, making it a powerful, lightweight, and free alternative with exceptional format compatibility and a familiar UI for seamless migration.

  1. 1. Download and Install WPS Office: Visit the official WPS website to download the free installation package.
  2. 2. Open Your Office Files: Seamlessly open your existing Word, Excel, and PowerPoint documents without losing any formatting.
  3. 3. Use Built-in VBA: Access the Developer tab in WPS Spreadsheet to write and execute your VBA macros easily.
Free and lightweight office suiteExcellent compatibility with Microsoft Excel (.xlsx, .xls, .xlsm)Built-in support for VBA and macros in spreadsheetsFamiliar user interface for seamless migration
microsoft office alternative - wps office

Frequently Asked Questions

Why do I get a 'User-defined type not defined' error in Access VBA?

This usually occurs when you use early binding (e.g., `Dim objOutlook As Outlook.Application`) without adding the Microsoft Outlook Object Library reference. You can fix this by going to Tools > References in the VBA editor and checking the Microsoft Outlook library, or by switching to late binding.

What is the difference between early binding and late binding in VBA?

Early binding requires a specific library reference to be checked in the VBA editor, offering autocomplete features but risking version conflicts across different computers. Late binding uses `CreateObject` and generic objects, sacrificing autocomplete during development for much better cross-version compatibility.

How can I bypass the Outlook security warning when sending emails via VBA?

Bypassing the prompt natively is difficult due to Microsoft's built-in security measures. Workarounds include ensuring your antivirus software is up-to-date and recognized by the Windows Security Center, adjusting Outlook Trust Center programmatic access settings, or deploying administrative Group Policy configurations.

Can I pull email addresses from an Access table to send bulk emails?

Yes, you can use a VBA Recordset (such as DAO or ADO) to loop through an Access table. You can either create and send an individual Outlook email for each record in the loop or concatenate the email addresses into a single string to use in the BCC field of one email.