VBA
5 TopicsOutlook 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!102Views0likes2CommentsAutomatically change FROM address based on subject line
I work on a team that uses our distro group as the FROM address line under certain scenarios. We send these emails out that always start with "Social Media Escalation - " followed by some other text that describes that unique situation. In these situations, we have a list of contacts in SharePoint that I've created a mailto link for that provides the proper contact and pre-populates the "Social Media Escalation - " subject line. I would like to know if there's a way that the FROM address changes automatically when the "Social Media Escalation - " subject line is being used. I'm never changed the FROM address field at any of my previous jobs so I don't know if the "Justification Required" is a default dialog box or something my company has done specifically but it's important to note that I have to select from three different options when it appears. We use "Previous label no longer applies" option when this prompt comes up (See screenshots for more details). I doubt there's a way to incorporate that in a mailto link but I'm very open to some trick that works. I don't know much about using VBA in Outlook but willing to do that as well. I'm pretty familiar with Power Automate but do not want to use that as a solution if possible. My assumption is if there is a way to do this, it's likely using Outlook VBA. Does anyone have any ideas or tricks they can share?813Views0likes0CommentsHow can I run VBA code for outlook in powershell?
I have some example code that I am using to test setting up outlook profiles using the profman library from Dmitry. https://www.dimastr.com/redemption/profman_examples.htm I know nothing on VBA but I wanted to impress my boss by trying to make an automated way of creating email profiles. Some of these test examples work but I can only run it in outlook through vba. Is there a way I can start outlook and run the vba script all from powershell? I am able to do this for excel and the macro I have for that but I haven't found a way to do this for outlook yet. Any suggestions? Thank you for your time,2.2KViews0likes0Comments