Document.CloseEvent 事件 (2007 system)

更新:2007 年 11 月

在关闭文档时发生。

命名空间:  Microsoft.Office.Tools.Word
程序集:  Microsoft.Office.Tools.Word.v9.0(在 Microsoft.Office.Tools.Word.v9.0.dll 中)

语法

声明
Public Event CloseEvent As DocumentEvents2_CloseEventHandler
用法
Dim instance As Document
Dim handler As DocumentEvents2_CloseEventHandler

AddHandler instance.CloseEvent, handler
public event DocumentEvents2_CloseEventHandler CloseEvent

示例

下面的代码示例在文档关闭时显示一条消息。

此示例针对的是文档级自定义项。

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

权限

另请参见

参考

Document 类

Document 成员

Microsoft.Office.Tools.Word 命名空间