WindowState Property

Microsoft Outlook Visual Basic

Returns or sets an OlWindowState constant specifying the window state of an explorer or inspector window. Read/write.

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.

Sub MinimizeWindows()
	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
End Sub
		

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

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