Document.Open Event (2007 System)

Occurs when the document is opened.

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

Syntax

'Declaration
Public Event Open As DocumentEvents2_OpenEventHandler
'Usage
Dim instance As Document 
Dim handler As DocumentEvents2_OpenEventHandler 

AddHandler instance.Open, handler
public event DocumentEvents2_OpenEventHandler Open
public:
 event DocumentEvents2_OpenEventHandler^ Open {
    void add (DocumentEvents2_OpenEventHandler^ value);
    void remove (DocumentEvents2_OpenEventHandler^ value);
}
JScript does not support events.

Examples

The following code example displays a message when the document opens.

This example is for a document-level customization.

Private Sub DocumentOpen()
    AddHandler Me.Open, AddressOf ThisDocument_Open
End Sub 

Private Sub ThisDocument_Open()
    MessageBox.Show("The document has opened.")
End Sub
private void DocumentOpen()
{
    this.Open += new Microsoft.Office.Interop.Word.DocumentEvents2_OpenEventHandler(ThisDocument_Open);
}

void ThisDocument_Open()
{
    MessageBox.Show("The document has opened.");
}

.NET Framework Security

See Also

Reference

Document Class

Document Members

Microsoft.Office.Tools.Word Namespace