New Event

DocumentBase.New Event

 

Occurs when a new document is created.

Namespace:   Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

public event DocumentEvents2_NewEventHandler New

This event is only raised when a new document is created from a template.

The following code example creates an event handler to display a message when a new document is created. To use this example, run it from the ThisDocument class in a Word Template project.

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.");
}
Return to top
Show:
© 2016 Microsoft