Application.WindowActivate Event (Word)
Occurs when any document window is activated.
Syntax
expression .Private Sub object_WindowActivate(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, see Using Events with the Application Object.
Parameters
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
Doc |
Required |
Document |
The document displayed in the activated window. |
Wn |
Required |
Window |
The window that's being activated. |
Example
This example maximizes any document window when it is activated. 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_WindowActivate _
(ByVal Wn As Word.Window)
Wn.WindowState = wdWindowStateMaximize
End Sub