Document.ActivateEvent (Evento)

Se produce cuando el documento se convierte en la ventana activa.

Espacio de nombres:  Microsoft.Office.Tools.Word
Ensamblado:  Microsoft.Office.Tools.Word (en Microsoft.Office.Tools.Word.dll)

Sintaxis

'Declaración
Event ActivateEvent As WindowEventHandler
event WindowEventHandler ActivateEvent

Comentarios

El evento ActivateEvent sólo tiene lugar cuando se mueve el foco dentro de una aplicación. Mover el foco a un objeto o desde el mismo en otra aplicación no activa el evento.

Ejemplos

El fragmento de código siguiente muestra un mensaje cuando se activa el documento. Se trata de un ejemplo para un complemento en el nivel de la aplicación.

Private Sub DocumentActivateEvent()
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    AddHandler vstoDoc.ActivateEvent, AddressOf ThisDocument_ActivateEvent
End Sub

Private Sub ThisDocument_ActivateEvent(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.WindowEventArgs)
    System.Windows.Forms.MessageBox.Show("The document has been activated")
End Sub
private void DocumentActivateEvent()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.ActivateEvent += new Microsoft.Office.Tools.Word.WindowEventHandler(ThisDocument_ActivateEvent);
}

void ThisDocument_ActivateEvent(object sender, Microsoft.Office.Tools.Word.WindowEventArgs e)
{
    System.Windows.Forms.MessageBox.Show("The document has been activated");
}

Seguridad de .NET Framework

Vea también

Referencia

Document Interfaz

Microsoft.Office.Tools.Word (Espacio de nombres)