VBA & Macro Problems

Fix an Excel VBA Outlook Email Macro That Stops at CreateObject

Adam DavisAdam Davis Nov 22, 2026 868 views

Question details

The user needs an Excel VBA macro to access Outlook and email workbooks after moving to Microsoft 365.

Fix an Excel VBA Outlook Email Macro That Stops at CreateObject
Product
Microsoft Excel and Outlook for Microsoft 365
Device & OS
not provided
Scenario
An Excel VBA macro creates an Outlook application object to send workbooks by email.
Observed behavior
The macro stops at CreateObject("Outlook.Application").
Before you start

Check which Outlook app is installed and note the exact VBA error message and number. The Outlook.Application COM automation used by this macro requires classic Outlook for Windows; new Outlook for Windows does not support this COM automation.

Solution 1Recommended

Connect to a running Outlook session before creating an object

Use GetObject first when classic Outlook may already be running, then fall back to CreateObject.

1
Open classic Outlook

Start classic Outlook and confirm that your email profile opens. Then open the workbook containing the macro in Excel.

2
Edit the macro

In Excel, press Alt+F11 to open the VBA editor. Open the module containing the email macro and replace its Outlook object initialization with the following code, avoiding duplicate declarations: Dim OutApp As Object Dim attemptedStart As Boolean On Error Resume Next Set OutApp = GetObject(, "Outlook.Application") On Error GoTo 0 If OutApp Is Nothing Then Set OutApp = CreateObject("Outlook.Application") attemptedStart = True End If

3
Run the email routine

Use OutApp in the existing code that creates and sends the email. Run the macro from Excel's Developer > Macros dialog and check whether it reaches the email creation step.

4
Release the object safely

After the email routine finishes, use Set OutApp = Nothing. Do not call OutApp.Quit unless you know the macro started a separate Outlook session that can safely be closed.

Connect to a running Outlook session before creating an object
Creating an object does not prove ownership: The attemptedStart flag records that the macro used CreateObject, but Outlook may reuse an existing session. Calling Quit could close Outlook that the user was already using.
Free Microsoft Office alternative

Work with Excel workbooks in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for opening and editing Office files. Its format compatibility helps you move existing workbooks into your workflow, although it does not repair Outlook COM automation in Microsoft Excel.

Open and edit Microsoft Excel XLSX and XLS filesReview workbooks before sharing them by emailUse a familiar spreadsheet interfaceMove existing Office documents into a lightweight suite
QA img-9

Frequently Asked Questions

Why does the macro try GetObject before CreateObject?

GetObject(, "Outlook.Application") attempts to connect to a running Outlook instance. If it returns no object, CreateObject can attempt to obtain an Outlook application object.

Does new Outlook for Windows support this VBA automation?

No. The Outlook.Application COM automation used by this macro requires classic Outlook for Windows. Open classic Outlook and retry the macro.

Should the macro always call Outlook.Quit?

No. Calling Quit can close a session the user is working in. Release the VBA reference with Set OutApp = Nothing, and call Quit only when you know it is safe to close the session.

What should I do if CreateObject still fails?

Record the error number and message in the VBA editor, verify that classic Outlook opens with a configured profile, and use the error details when contacting Microsoft Support or your administrator.

Can WPS Office fix the Outlook CreateObject error?

No. WPS Office can open and edit Excel-format workbooks, but it does not repair Microsoft Outlook COM automation or guarantee that an Excel VBA email macro will run unchanged.