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 命名空間