DocumentBase.New 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在创建新文档时发生。
public event Microsoft.Office.Interop.Word.DocumentEvents2_NewEventHandler New;
事件类型
示例
下面的代码示例创建一个事件处理程序,以便在创建新文档时显示一条消息。 若要使用此示例,请从 ThisDocument Word 模板项目的类中运行它。
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.");
}
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
注解
仅当从模板创建新文档时才会引发此事件。