Share via


DocumentBase.Deactivate Event

Definition

Occurs when the active document window loses focus.

public:
 event Microsoft::Office::Tools::Word::WindowEventHandler ^ Deactivate;
public event Microsoft.Office.Tools.Word.WindowEventHandler Deactivate;
member this.Deactivate : Microsoft.Office.Tools.Word.WindowEventHandler 
Public Custom Event Deactivate As WindowEventHandler 

Event Type

Examples

The following code example displays a message when the document is deactivated. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentDeactivate()
{
    this.Deactivate += new Microsoft.Office.Tools.Word.WindowEventHandler(ThisDocument_Deactivate);
}

void ThisDocument_Deactivate(object sender, Microsoft.Office.Tools.Word.WindowEventArgs e)
{
    MessageBox.Show ("The document has been deactivated");
}
Private Sub DocumentDeactivate()
    AddHandler Me.Deactivate, AddressOf ThisDocument_Deactivate
End Sub

Private Sub ThisDocument_Deactivate(ByVal sender As Object, ByVal e As Microsoft.Office.Tools.Word.WindowEventArgs)
    MessageBox.Show("The document has been deactivated")
End Sub

Remarks

The Deactivate event does not occur when you unload the document.

Applies to