Windows Property

Microsoft Excel Visual Basic

For an Application object, returns a Windows collection that represents all the windows in all the workbooks. For a Workbook object, returns a Windows collection that represents all the windows in the specified workbook. Read-only Windows object.

Remarks

For information about returning a single member of a collection, see Returning an Object from a Collection.

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