DocumentBase.CloseEvent 事件

定义

在关闭文档时发生。

public event Microsoft.Office.Interop.Word.DocumentEvents2_CloseEventHandler CloseEvent;

事件类型

DocumentEvents2_CloseEventHandler

示例

下面的代码示例在文档关闭时显示一条消息。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。

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

适用于