Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.