Condividi tramite


Evento DocumentBase.CloseEvent

Viene generato alla chiusura del documento.

Spazio dei nomi:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Sintassi

'Dichiarazione
Public Event CloseEvent As DocumentEvents2_CloseEventHandler
public event DocumentEvents2_CloseEventHandler CloseEvent

Esempi

Nell'esempio di codice riportato di seguito viene illustrato come visualizzare un messaggio alla chiusura del documento. Per utilizzare questo esempio, eseguirlo dalla classe ThisDocument in un progetto a livello di documento.

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.");
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

DocumentBase Classe

Spazio dei nomi Microsoft.Office.Tools.Word