Applies To
Application Object, Workbook Object.
Description
Accessor. Returns an object that represents a single window (a Window object, Syntax 1) or a collection of windows (the Windows object, Syntax 2). Read-only.
Syntax 1
object.Windows(index)
Syntax 2
object.Windows
object
Optional for Application, required for Workbook. If Application (or omitted) this method returns a window (or windows) from any open workbook. If Workbook, this method returns a window (or windows) in the specified workbook.
index
Required for Syntax 1. The name or number of the window.
Remarks
Syntax 2 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 sets the name of window one in the active workbook to Consolidated Balance Sheet. This name is then used as the index to the Windows method.
ActiveWorkbook.Windows(1).Caption = "Consolidated Balance Sheet" ActiveWorkbook.Windows("Consolidated Balance Sheet") _ .ActiveSheet.Calculate