Export (0) Print
Expand All

Application.WindowActivate Event (Word)

Published: July 16, 2012

Occurs when any document window is activated.

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.

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

Community Additions

ADD
Show:
© 2014 Microsoft