Share via


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)

Syntax

'Declaration
Public Event New As DocumentEvents2_NewEventHandler
public event DocumentEvents2_NewEventHandler New

Remarks

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

Examples

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 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 Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace