Share via


Windows2 オブジェクト (Project)

アプリケーションまたはプロジェクト内にあるウィンドウまたはウィンドウのコレクションを表します。

注釈

注:

[!メモ] 新しく開発する場合には、 Windows コレクションではなく Windows2 コレクションを使用することをお勧めします。

上位オブジェクトが Application オブジェクトの場合、 Windows2 コレクションにはアプリケーション内のすべてのウィンドウが含まれます。上位オブジェクトが Project オブジェクトの場合、 Windows2 コレクションには指定したプロジェクトのウィンドウだけが含まれます。

.NET Framework 4 を使用して、または Project を自動化する外部コンポーネントやアプリケーションを使用して開発する場合には、 Windows オブジェクトではなく Windows2 オブジェクトを使用する必要があります。 Project の COM インターフェイスとの相互運用が適切に行われるようにするには、プライマリ相互運用機能アセンブリ (PIA) が必要です (コンポーネントに署名する予定の場合)。 PIA がない場合、Microsoft Visual Studio によってタイプ ライブラリを基に相互運用アセンブリを生成できますが、そのコンポーネントにはデジタル証明書を使用して署名できなくなります。 PIA は Project に含まれています。

Windows2 コレクションの使い方

Use the Windows2 property to return a Windows2 collection.

次の使用例は、Project で現在表示されているすべてのウィンドウを少しずつ重ねて表示します。

With Application.Windows2  
    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 Windows2 collection.

次の使用例は、作業中のプロジェクトで新しいウィンドウを作成します。

Application.WindowNewWindow

Windows2 オブジェクトの使い方

Windows2 オブジェクトの使い方

1 つの Window オブジェクトを取得するには、Windows2 (Index) を使用します。ここで、Index はウィンドウ インデックス番号またはウィンドウ キャプションです。

次の使用例は、ウィンドウの一覧の 1 番目のウィンドウを最大化します。

Application.Windows2(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.Windows2(1).Caption = "Project1" Then  
    Application.Windows2(1).Visible = False  
End If

プロパティ

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

関連項目

Project オブジェクト モデル

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

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