Fix an Excel VBA Outlook Email Macro That Stops at CreateObject
Question details
The user needs an Excel VBA macro to access Outlook and email workbooks after moving to Microsoft 365.

- 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").
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.
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.
Start classic Outlook and confirm that your email profile opens. Then open the workbook containing the macro in Excel.
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
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.
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.

Check Outlook compatibility and the VBA error
Use this approach if CreateObject still fails after the GetObject fallback is added.
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.

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.




