Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Occurs when the document is closed.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)
Syntax
'Declaration
Public Event CloseEvent As DocumentEvents2_CloseEventHandler
'Usage
Dim instance As Document
Dim handler As DocumentEvents2_CloseEventHandler
AddHandler instance.CloseEvent, handler
public event DocumentEvents2_CloseEventHandler CloseEvent
public:
event DocumentEvents2_CloseEventHandler^ CloseEvent {
void add (DocumentEvents2_CloseEventHandler^ value);
void remove (DocumentEvents2_CloseEventHandler^ value);
}
JScript does not support events.
Examples
The following code example displays a message when the document is closed.
This example is for a document-level customization.
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.