Forum Discussion
Outlook 2016/2021 remains running after CreateObject() from VBA in Version 2412 and later
Hi everyone,
I’d like to report a behavior change that affects Outlook (Classic) in Office 2016 and 2021, starting from Version 2412 (Build 16.0.18324.20168).
We use VBA to check whether Outlook is installed and configured for sending/receiving mail. We do this at startup of MS Access (2016, 2021 and 365) apps on Windows 11, but I guess this will be the same out of Excel, Word,... . The check is simple and basically does nothing like this:
Dim objOutlook As Object
On Error Resume Next
Set objOutlook = GetObject(, "Outlook.Application")
If objOutlook Is Nothing Then
bolOutlookIsThere = False
Else
bolOutlookIsThere = True
Set objOutlook = Nothing
End If
On Error Goto 0
In Build 16.0.18227.20162 (Version 2411) and in Microsoft 365 Outlook, this results in no lasting Outlook process - the instance is released properly. However, starting with Version 2412, this same code causes OUTLOOK.EXE to remain running in Task Manager after execution. The System tray shows up a grayed-out outlook symbol saying "outlook is going to be closed" --- forever.
If Outlook had been started manually before running this code, everything works fine, that is: the extra instance will be released and a subsequent manually closing of Outlook will remove the whole.
This causes problems in scripts and services that expect to perform a "clean" check without side effects.
This same COM automation pattern works exactly as expected with both Excel and Word - they terminate automatically when the last object reference is released (via Set = Nothing), assuming they were not already running.
Outlook, however, remains running in memory starting with Version 2412, even though no UI is shown and all references are cleared. This strongly suggests that Outlook now maintains additional internal session state or background services that prevent the process from terminating - unlike other Office applications.
Confirmed behavior:
Office 2016/2021, Version 2412+ -> OUTLOOK.EXE remains in memory.
Office 2016/2021, Version 2411 -> no leftover process.
Microsoft 365 Outlook -> behaves as expected.
Excel, Word -> behave as expected
Can anyone from Microsoft confirm whether this is an intentional change in COM/session behavior (possibly due to caching or MAPI preloading)? If so, is there a recommended workaround for non-interactive detection of Outlook availability?
Is anyone else able to duplicate this behavior and/or able to find a workaround (other than downgrading Office to Version 2411)?
Thanks in advance!
2 Replies
- MysterCamelIron Contributor
Add Application.Quitat the end of your VBA code to force-close Outlook. Then update Office to the latest version. If the process still lingers, check if COM objects are properly released, or replace CreateObjectwith GetObjectin your code.
- Hans-DieterGehlenCopper Contributor
Add Application.Quitat the end of your VBA code to force-close Outlook
Tried that already. That didn't help.
Then update Office to the latest version.
Version 2506 Build 16.0.18925.20076. Should be the latest non-beta version.
check if COM objects are properly released
Which other COM objects should be released if I never instantiated any other? We're talking about a fresh instance of Outlook.
replace CreateObjectwith GetObjectin your code.
How can I create an Outlook instance with GetObject if it is not running at all? My issue is just for this case. If Outlook was started before: no issue.
Any idea on why before update 2412, there was no issue at all?