WindowState Property
Applies To
Application object, Task object, Window object.
Description
Returns or sets the state of the specified document window or task window. Can be one the following WdWindowState constants: wdWindowStateMaximize, wdWindowStateMinimize, or wdWindowStateNormal. Read/write Long.
Remarks
The wdWindowStateNormal constant indicates a window that's not maximized or minimized. The state of an inactive window cannot be set. Use the Activate method to activate a window prior to setting the window state.
See Also
Activate method, Arrange method.
Example
This example maximizes the active window if it's not maximized or minimized.
If ActiveWindow.WindowState = wdWindowStateNormal Then _
ActiveWindow.WindowState = wdWindowStateMaximize
This example minimizes the Microsoft Excel application window.
For Each myTask In Tasks
If InStr(myTask.Name, "Microsoft Excel") > 0 Then
myTask.Activate
myTask.WindowState = wdWindowStateMinimize
End If
Next myTask