Application.WindowDeactivate Event (Word)

Occurs when any document window is deactivated.

expression .Private Sub object_WindowDeactivate(ByVal Doc As Document, ByVal Wn As Window)

expression A variable that represents an Application object that has been declared with events in a class module. For more information about using events with the Application object or the Document object, see Using Events with the Application Object or Using Events with the Document Object.

Parameters

Name

Required/Optional

Data Type

Description

Doc

Required

Document

The document displayed in the deactivated window.

Wn

Required

Window

The deactivated window.

This example minimizes any document window when it is deactivated. This code must be placed in a class module, and an instance of the class must be correctly initialized to see this example work; see Using Events with the Application Object for directions on how to accomplish this.

Public WithEvents appWord as Word.Application 
 
Private Sub appWord_WindowDeactivate _ 
 (ByVal Wn As Word.Window) 
 Wn.WindowState = wdWindowStateMinimize 
End Sub
Show:
© 2015 Microsoft