Share via


DocumentBase.CloseEvent Event

Definition

Occurs when the document is closed.

public:
 event Microsoft::Office::Interop::Word::DocumentEvents2_CloseEventHandler ^ CloseEvent;
public event Microsoft.Office.Interop.Word.DocumentEvents2_CloseEventHandler CloseEvent;
member this.CloseEvent : Microsoft.Office.Interop.Word.DocumentEvents2_CloseEventHandler 
Public Custom Event CloseEvent As DocumentEvents2_CloseEventHandler 

Event Type

Examples

The following code example displays a message when the document is closed. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentCloseEvent()
{
    this.CloseEvent += new Microsoft.Office.Interop.Word.DocumentEvents2_CloseEventHandler(ThisDocument_CloseEvent);
}

void ThisDocument_CloseEvent()
{
    MessageBox.Show("The document is closing.");
}
Private Sub DocumentCloseEvent()
    AddHandler Me.CloseEvent, AddressOf ThisDocument_CloseEvent
End Sub
Sub ThisDocument_CloseEvent()
    MessageBox.Show("The document is closing.")
End Sub

Applies to