Document.Deactivate (Evento)

Se produce cuando la ventana activa del documento pierde el foco.

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

Sintaxis

'Declaración
Event Deactivate As WindowEventHandler
event WindowEventHandler Deactivate

Comentarios

El evento Deactivate no se produce cuando se descarga el documento.

Ejemplos

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

Private Sub DocumentDeactivate()
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    AddHandler vstoDoc.Deactivate, AddressOf ThisDocument_Deactivate
End Sub

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

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

Seguridad de .NET Framework

Vea también

Referencia

Document Interfaz

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