WindowState Property Example

This example maximizes the active window if it's not maximized or minimized.

If ActiveDocument.ActiveWindow _
    .WindowState = wdWindowStateNormal Then _
    ActiveDocument.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