Occurs when the environment is being shut down.
Public Sub OnBeginShutdown( _ ByVal custom() As Variant _ )
Sub OnBeginShutdown( _ ByVal custom() As Variant _ )
HRESULT __stdcall OnBeginShutdown( SAFEARRAY** custom );
void OnBeginShutdown( object custom );
public function OnBeginShutdown( custom : Object )
- An array of Variants that you can use to provide additional data.
OnBeginShutdown is a method that, when its host interface is implemented, acts as an event that occurs while the environment is being shut down.
The OnBeginShutdown event occurs when a host application begins its shutdown routines; that is, when a application closes while the Add-in is still loaded. If the Add-in is not currently loaded when the application closes, the OnBeginShutdown event does not occur. When this event does occur, it occurs before the OnDisconnection event.
You can use the OnBeginShutdown event procedure to run code when the user closes an application. For example, you can run code that saves form data to a file.
It is possible that OnBeginShutdown can occur more than once. If an event handler cancels the environment shutdown, the next time the environment begins to shut down, OnBeginShutdown will occur again.
Note that this code works only in an Add-In project, not in macros.
Imports Microsoft.Office.Core imports Extensibility imports System.Runtime.InteropServices Imports EnvDTE <GuidAttribute("B25D9733-A1B2-420D-8F6B-478E2B051C83"), ProgIdAttribute("MyAddin1.Connect")> _ Public Class Connect Implements Extensibility.IDTExtensibility2 Dim applicationObject As EnvDTE.DTE Dim addInInstance as EnvDTE.AddIn Public Sub OnBeginShutdown(ByRef custom As System.Array) Implements Extensibility.IDTExtensibility2.OnBeginShutdown Msgbox("Shutdown event occuring.") End Sub End Class
Applies To: IDTExtensibility2 Interface