How to programmatically handle PowerPoint close event in Office Com add-ins?
1 answer
Since Shared Add-ins implements the interface IDTExtensibility2
, you must implement the OnBeginShutdown
and methods OnDisconnection
. OnDisconnection
will be called whenever your add-in is unloaded, OnBeginShutdown
will be called when the host application i.e. PowerPoint, in your case, will be closed:
/// <summary>
/// Implements the OnBeginShutdown method of the IDTExtensibility2 interface.
/// Receives notification that the host application is being unloaded.
/// </summary>
/// <param term='custom'>
/// Array of parameters that are host application specific.
/// </param>
/// <seealso class='IDTExtensibility2' />
public virtual void OnBeginShutdown(ref System.Array custom)
{
// do clean-up when PowerPoint exits.
}
Note that you might rather consider the add-in unload event than the host shutdown event, as the unload event is where your add-in cleanup should happen.
0
a source to share