Share via


Windows オブジェクト (Project)

Window オブジェクトのコレクションを格納します。 Application オブジェクトの Windows コレクションには、アプリケーションのすべてのウィンドウが含まれるのに対し、 Project オブジェクトの Windows コレクションには指定されたプロジェクトのウィンドウだけが含まれます。

注釈

注:

[!メモ] Windows コレクションは、以前のバージョンとの互換性を保持するために用意されています。 新しく開発する場合には、 Windows2 コレクションを使用することをお勧めします。

Window オブジェクトの使い方

1 つの Window オブジェクトを返すには、Windows ( Index) を使用します。Index はウィンドウインデックス番号またはウィンドウキャプションです。 次の使用例は、ウィンドウの一覧の 1 番目のウィンドウを最大化します。

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 is not 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 does not change the name of the project. The following example hides the window that contains the caption "Project1".

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

Windows コレクションの使い方

Windows コレクションを取得するには、Windows プロパティを使用します。 次の使用例は、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

プロパティ

名前
ActiveWindow
アプリケーション
Count
アイテム
Parent

関連項目

Project オブジェクト モデル

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。