Read-only. A Long type property. Returns the state of the window.
Applies to: Window object
[[Let] stateRet = ] object.State |
The State property syntax has these parts:
Part | Description |
object | Required. An expression, that returns a Window object. |
stateRet | Optional. A Long type variable. |
The State property can take the following values:
Value | Constant | Description |
0 | cdNormal | This window has the normal position and size. |
1 | cdMaximized | The window is maximized to full screen. |
2 | cdMinimized | The window is minimized. |
The state of the window and the value of the State property can be modified by using the following methods: Maximize, Minimize and Restore.
This example contains a document-level script. It demonstrates how the value of the State property is changed by using the Maximize, Minimize and Restore methods.
' Declare variables Dim state As Integer ' Remember the state of the document window state = thisDoc.FirstView().State ' Display the current state TRACE state ' Maximize the window thisDoc.FirstView().Maximize() MsgBox( "State = " & thisDoc.FirstView().State ) ' Minimize the window thisDoc.FirstView().Minimize() MsgBox( "State = " & thisDoc.FirstView().State ) ' Set the normal state of the window thisDoc.FirstView().Restore() MsgBox( "State = " & thisDoc.FirstView().State ) ' Restore the original state of the window If state = 0 Then thisDoc.FirstView().Restore() Else If state = 1 Then thisDoc.FirstView().Maximize() Else If state = 2 Then thisDoc.FirstView().Minimize() End If |
See Also |
Type property, Maximize method, Minimize method, Restore method |