Reputation: 49
I have created an Outlook add-in and I want to run a couple of lines on closing of Outlook, but I cannot find where to put the code.
I tested ThisAddIn_Shutdown
and Ribbon1_Unload
events, but the debugger
does not hit a breakpoint in either event.
Any suggestions or workarounds?
Upvotes: 1
Views: 471
Reputation: 3777
You are correct about the ThisAddIn_Shutdown
event:
The Shutdown event is raised only when the user disables the VSTO Add-in by using the COM Add-ins dialog box in Outlook. It is not raised when Outlook exits.
You want either the Quit
event of the Microsoft.Office.Interop.Outlook.Application
object or the Close
event of the Microsoft.Office.Interop.Outlook.Explorer
object.
See this documentation for more details.
Upvotes: 1