Export (0) Print
Expand All

Document.Shutdown Event (2007 System)

Updated: July 2008

Occurs when the document host item shuts down.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

public event EventHandler Shutdown

This is the last event to be called in the Document class as the Document class unloads. Use this event for any additional clean up.

In a document-level customization, the application domain for the assembly unloads when the document host item shuts down.

In an application-level add-in, the application domain does not unload when the document host item shuts down. Also, the underlying document object is no more available. To access the document before it shuts down use CloseEvent instead.

The following code example adds a new Shutdown event handler that displays a message that shows that the document is shutting down.

This example is for a document-level customization.

private void DocumentShutdown()
    this.Shutdown +=new EventHandler(ThisDocument_Shutdown2);


private void ThisDocument_Shutdown2(object sender, System.EventArgs e)
    MessageBox.Show("The Shutdown event was raised.");




July 2008

Added additional remarks that are specific to application-level add-ins.

SP1 feature change.

Community Additions

© 2015 Microsoft