Share via


DocumentBase.CloseEvent Event

Occurs when the document is closed.

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

Syntax

'Declaration
Public Event CloseEvent As DocumentEvents2_CloseEventHandler
public event DocumentEvents2_CloseEventHandler CloseEvent

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 Sub DocumentCloseEvent()
    AddHandler Me.CloseEvent, AddressOf ThisDocument_CloseEvent
End Sub
Sub ThisDocument_CloseEvent()
    MessageBox.Show("The document is closing.")
End Sub
private void DocumentCloseEvent()
{
    this.CloseEvent += new Microsoft.Office.Interop.Word.DocumentEvents2_CloseEventHandler(ThisDocument_CloseEvent);
}

void ThisDocument_CloseEvent()
{
    MessageBox.Show("The document is closing.");
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace