WindowActivate Event

Occurs when any document window is activated.

Private Subobject**_WindowActivate(ByValDocAs Word.Document**, ByValWnAs Word.Window)

object An object of type Application 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 .

Doc Used only with the Application object. The document displayed in the activated window.

Wn The window that's being activated.

Example

This example maximizes any document window when it's activated. This code must be placed in a class module, and an instance of the class must be correctly initialized in order 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_WindowActivate _
        (ByVal Wn As Word.Window)
    Wn.WindowState = wdWindowStateMaximize
End Sub

Applies to | Application Object

See Also | WindowBeforeDoubleClick Event | WindowBeforeRightClick Event | WindowDeactivate Event | WindowSelectionChange Event