WindowState Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

OlWindowState

OlWindowState can be one of these OlWindowState constants.
olMaximized
olMinimized
olNormalWindow

object**.WindowState**

object   Required. An expression that returns an Explorer or Inspector object.

Example

This Microsoft Visual Basic/Visual Basic for Applications example minimizes all open explorer windows. It uses the Count property and Item method of the Explorers collection to enumerate the open explorer windows.

  Dim myOlApp As New Outlook.Application
Dim myOlExp As Outlook.Explorer
Dim myOlExps As Outlook.Explorers
Set myOlExps = myOlApp.Explorers
For x = 1 To myOlExps.Count
    myOlExps.Item(x).WindowState = olMinimized
Next x

If you use VBScript, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript.

  For x = 1 To Application.Explorers.Count
    Application.Explorers.Item(x).WindowState = 2
Next