DocumentBase.New 事件
在建立新文件時發生。
命名空間: Microsoft.Office.Tools.Word
組件: Microsoft.Office.Tools.Word.v4.0.Utilities (在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)
語法
'宣告
Public Event New As DocumentEvents2_NewEventHandler
public event DocumentEvents2_NewEventHandler New
備註
只有從範本建立新文件時才會引發此事件。
範例
下列程式碼範例會建立事件處理常式,以便在建立新文件時顯示訊息。 若要使用這個範例,請從 Word 範本專案中的 ThisDocument 類別中執行。
Private Sub DocumentNew()
AddHandler Me.New, AddressOf ThisDocument_New
End Sub
Private Sub ThisDocument_New()
MessageBox.Show("The Document.New event has fired.")
End Sub
private void DocumentNew()
{
this.New += new Microsoft.Office.Interop.Word.
DocumentEvents2_NewEventHandler(
ThisDocument_New);
}
void ThisDocument_New()
{
MessageBox.Show("The Document.New event has fired.");
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。