Window Object, Windows Collection Object

Multiple objects
Windows
Window
Pane

Represents a window or windows in the application or project. The Window object is a member of the Windows collection. The Windows collection for the Application object contains all the windows in the application, whereas the Windows collection for the Project object contains only the windows in the specified project.

Using the Window Object

Use Windows(Index), where Index is the window index number or window caption, to return a single Window object. The following example maximizes the first window in the window list.

Application.Windows(1).WindowState = pjMaximized

The window caption is the text shown in the title bar at the top of the window when the window isn't maximized. The caption is also shown in the list of open files on the bottom of the Windows menu. Use the Caption property to set or return the window caption. Changing the window caption doesn't change the name of the project. The following example hides the window containing "Project1".

If Application.Windows(1).Caption = "Project1" Then
    Application.Windows(1).Visible = False
End If

Using the Windows Collection

Use the Windows property to return a Windows collection. The following example cascades all the windows that are currently displayed in Project.

With Application.Windows
    For I = 1 To .Count
        .Item(I).Activate
        .Item(I).Top = (I - 1) * 15
        .Item(I).Left = (I - 1) * 15
    Next I
End With

Use the WindowNewWindow method to create a new window and add it to the collection. The following example creates a new window for the active project.

Application.WindowNewWindow

Remarks

The Windows collection is maintained for backward compatibility. It is recommended that the Windows2 collection be used for all new development. See Windows2 Object, Windows2 Collection Object.

Properties | ActivePane Property | Application Property | BottomPane Property | Count Property | Index Property | Item Property | Parent Property | TopPane Property

Methods | Activate Method | Close Method | Refresh Method | WebBrowserControlFrame Method | WebBrowserControlWindow Method

Parent Objects | Application Object | Project Object, Projects Collection Object | Windows2 Collection Object

Child Objects | Pane Object

See Also | TimeScaleData Method | Windows2 Collection Object