DocumentBase.Open 事件

在打开文档时发生。

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

语法

声明
Public Event Open As DocumentEvents2_OpenEventHandler
public event DocumentEvents2_OpenEventHandler Open

示例

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

Private Sub DocumentOpen()
    AddHandler Me.Open, AddressOf ThisDocument_Open
End Sub

Private Sub ThisDocument_Open()
    MessageBox.Show("The document has opened.")
End Sub
private void DocumentOpen()
{
    this.Open += new Microsoft.Office.Interop.Word.DocumentEvents2_OpenEventHandler(ThisDocument_Open);
}

void ThisDocument_Open()
{
    MessageBox.Show("The document has opened.");
}

.NET Framework 安全性

请参见

参考

DocumentBase 类

Microsoft.Office.Tools.Word 命名空间