WorksheetBase.Shutdown Event
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Occurs when the worksheet host item shuts down.
public:
event EventHandler ^ Shutdown;
public event EventHandler Shutdown;
member this.Shutdown : EventHandler
Public Custom Event Shutdown As EventHandler
Event Type
Examples
The following code example demonstrates a handler for the Shutdown event that displays a message when the WorksheetBase class unloads.
This example is for a document-level customization.
private void WorksheetShutdown()
{
this.Shutdown += new EventHandler(Worksheet1_Shutdown);
}
void Worksheet1_Shutdown(object sender, EventArgs e)
{
MessageBox.Show(this.Name + " is shutting down.");
}
Private Sub Worksheet1_Shutdown(ByVal sender As Object, ByVal e As EventArgs) _
Handles Me.Shutdown
MsgBox(Me.Name & " is shutting down.")
End Sub
Remarks
This is the last event to be called in the WorksheetBase class as the WorksheetBase class unloads. Use this event for any additional clean up.
In a document-level customization, the application domain for the assembly unloads when the worksheet host item shuts down.
In an application-level add-in, the application domain does not unload when the worksheet host item shuts down. Also, the underlying worksheet object is no more available. To access the worksheet before it shuts down use BeforeClose instead.