Skip to main content

Application.Windows property

Table of contents
  1. Syntax
  2. Remarks
  3. Example

Returns a Windows collection that represents all the windows in all the workbooks. Read-only Windows object.

Syntax

expression.Windows

expression A variable that represents an Application object.

Remarks

Using this property without an object qualifier is equivalent to using Application.Windows.

This property returns a collection of both visible and hidden windows.

Example

This example closes the first open or hidden window in Microsoft Excel.

Application.Windows(1).Close

This example names window one in the active workbook Consolidated Balance Sheet. This name is then used as the index to the Windows collection.

ActiveWorkbook.Windows(1).Caption = "Consolidated Balance Sheet"
ActiveWorkbook.Windows("Consolidated Balance Sheet").ActiveSheet.Calculate

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>