logo
search
VBA & Macro Problems

How to Check if Outlook is Installed Before Sending Email from Access VBA

Partner EditorPartner Editor Oct 8, 2026 869 views

Question details

The user needs a method to verify whether Microsoft Outlook is installed and available before executing VBA code to send emails from Microsoft Access.

How to Check if Outlook is Installed Before Sending Email from Access VBA
Product
Microsoft Access
Device & OS
not provided
Scenario
Automating email delivery through Microsoft Access using late binding, which fails if Outlook is missing.
Observed behavior
The Access application throws VBA error -2147418113 (Class not registered) and crashes when attempting to create the Outlook.Application object on systems where Outlook is not installed, unavailable, or improperly registered.
Before you start

Ensure you have access to the VBA Integrated Development Environment (IDE) in your Microsoft Access database and understand how to navigate to the module containing your email automation code.

Solution 1Recommended

Use a VBA Error Handler for Late Binding

Implement an inline error handler to safely attempt creating the Outlook object, catching the runtime error gracefully if the application is missing.

When using late binding, Access relies on the Windows Registry to launch external applications. By intentionally bypassing the default error halt, you can test if the object creation is successful and display a friendly message or switch to an alternative email method (like SMTP) if Outlook is unavailable.

1
Open the VBA Editor

In your Microsoft Access database, press ALT + F11 to open the Visual Basic for Applications (VBA) editor.

2
Locate Your Email Code

Find the function or subroutine where you automate your email sending.

3
Add Inline Error Handling

Right before the line that creates the Outlook object, add the statement: On Error Resume Next.

4
Attempt Object Creation

Execute the late binding command: Set objOutlook = CreateObject("Outlook.Application").

5
Test for Errors

Immediately after creation, check the error code by adding: If Err.Number <> 0 Then. If true, Outlook is not installed or available.

6
Clear the Error and Reset

Inside the If block, alert the user with a message box, clear the error using Err.Clear, and exit the routine safely. Remember to add On Error GoTo 0 afterwards to restore normal error handling.

Use a VBA Error Handler for Late Binding
Consider Alternative Delivery Methods: If you detect that Outlook is unavailable, you can program your VBA script to fall back on using CDO (Collaboration Data Objects) to send emails directly via an SMTP server.
Free Microsoft Office alternative

Looking for a Lightweight Alternative for Your Daily Office Work?

While complex database automation is handled in Microsoft Access, you can seamlessly manage your standard spreadsheets, documents, and presentations using WPS Office. It is highly compatible with Microsoft formats and requires a fraction of the system resources.

  1. 1. Visit the Website: Go to the official WPS Office website to find the correct version for your device.
  2. 2. Download the Installer: Click the Free Download button and save the installer to your computer.
  3. 3. Install and Start: Run the installer, follow the simple setup steps, and open WPS Office to handle your daily tasks.
Highly compatible with Microsoft Excel (.xlsx), Word (.docx), and PowerPoint (.pptx) formatsLightweight suite that runs smoothly on most devices without heavy background processesFamiliar user interface requiring zero learning curve for seamless migrationBuilt-in PDF tools for effortless document sharing and editing
microsoft office alternative - wps office

Frequently Asked Questions

Does clearing the VBA error with Err.Clear prevent Access from crashing completely?

Clearing the error with Err.Clear resets the error object for that specific block of code, stopping the immediate VBA runtime halt. However, it does not prevent Access from crashing if subsequent unhandled errors occur or if the core application encounters deeper instability.

Why do I get a Class not registered error when Outlook is definitely installed?

The -2147418113 VBA error can still occur if your Outlook installation is corrupted, the Windows Registry entries are incorrect, or there is a bitness mismatch between your programs (for example, attempting to automate a 64-bit Outlook installation from 32-bit Access).

Can I use early binding to check if Outlook is installed instead?

Early binding is not recommended for environments where Outlook might be missing. It requires a direct reference to the Outlook Object Library. If the library is missing on the user's computer, the database project will fail to compile and throw 'Missing Reference' errors before the code even runs.