DocumentBase.Open Event

Definition

Occurs when the document is opened.

public event Microsoft.Office.Interop.Word.DocumentEvents2_OpenEventHandler Open;

Event Type

DocumentEvents2_OpenEventHandler

Examples

The following code example displays a message when the document opens. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentOpen()
{
    this.Open += new Microsoft.Office.Interop.Word.DocumentEvents2_OpenEventHandler(ThisDocument_Open);
}

void ThisDocument_Open()
{
    MessageBox.Show("The document has opened.");
}
Private Sub DocumentOpen()
    AddHandler Me.Open, AddressOf ThisDocument_Open
End Sub

Private Sub ThisDocument_Open()
    MessageBox.Show("The document has opened.")
End Sub

Applies to