Udostępnij za pośrednictwem


DocumentBase.Open Event

Definition

Occurs when the document is opened.

public:
 event Microsoft::Office::Interop::Word::DocumentEvents2_OpenEventHandler ^ Open;
public event Microsoft.Office.Interop.Word.DocumentEvents2_OpenEventHandler Open;
member this.Open : Microsoft.Office.Interop.Word.DocumentEvents2_OpenEventHandler 
Public Custom Event Open As DocumentEvents2_OpenEventHandler 

Event Type

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