I have this same issue with code that I have in ThisOutlookSession that analysis each email as it comes in. It happens sometimes once a day or sometimes once a week. I'm also using Outlook 365 desktop app on Windows 10 Pro. I've been using this same code (with minor changes) for 10 years now. It worked fine on Windows 7 Pro using Outlook 2007 and Outlook 2010. I've made sure that the system isn't going to sleep or anything funny like that. Closing Outlook and re-opening get it's working again. How can I capture when ThisOutlookSession stops working?
Outlook VBA code stops working intermittently

Hi - Hoping somebody could help with an ongoing issue with a VBA script used in Outlook:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim xPrompt As String
Dim xOkOrCancel As Integer
On Error Resume Next
xPrompt = "Are you sure you want to send to this person?"
xOkOrCancel = MsgBox(xPrompt, vbOKCancel)
If xOkOrCancel <> vbOK Then
Cancel = True
End If
End Sub
Essentially it just brings a popup when sending an email. The script works great. I have set this up in the Outlook VBA script editor under 'ThisOutlookSession'. Also I have selected the 'Notifications for all macros' setting in Trust center settings. I receive a popup message when opening Outlook to 'Enable Macros' I select enable and all is well.
However, every so often (Maybe once a fortnight) it stops working and I get no popup. No settings have changed in trust center and script is still there in VBA script editor. I normally resolve by removing and re-adding the script > press save > close & reopen Outlook and this seems to sort. It's not a huge problem but can be quite frustrating.
Would anybody know what causes this issue? Or how to stop this happening permanently?
For reference, I'm using Office 365 Outlook desktop app on Windows 10. Any help much appreciated - Thanks
Thanks for your response. I have removed that line of code and it still seems to work for now.
As the issue is intermittent and only happens every so often I won't know if it is resolved straightaway. But I will let you know on this thread if this resolves - Thanks for your help
Hi - I can confirm that this did not resolve the issue sorry. The VBA macros stopped working again today and had trouble re-adding it back on. But thanks for your help.
Could it be my version of Windows perhaps? Is a factory reset my only option? - Cheers
Same issue here, mine stopped triggering within 20 hours (no hibernation, just screensaver since macro enabled).
Outlook 2016 (16.0.4266.1001 MSO 16.0.5366.1000 32-bit)
VBA retail 7.1.1127
Windows 10 21H2 (english) Enterprise (OS Build 19044.2251)
Sign in to comment