Window 对象 (Excel)Window object (Excel)

代表窗口。Represents a window.


许多工作表特征(如滚动条和标尺)实际上是窗口的属性。Many worksheet characteristics, such as scroll bars and gridlines, are actually properties of the window. Window 对象是 Windows 集合中的成员。The Window object is a member of the Windows collection.

Application 对象的 Windows 集合包含应用程序中的所有窗口,而 Workbook 对象的 Windows 集合只包含指定工作簿中的窗口。The Windows collection for the Application object contains all the windows in the application, whereas the Windows collection for the Workbook object contains only the windows in the specified workbook.


使用**Windows** (索引), 其中_索引_是窗口名称或索引号, 返回单个窗口对象。Use Windows (index), where index is the window name or index number, to return a single Window object. 以下示例将最大化活动窗口。The following example maximizes the active window.

Windows(1).WindowState = xlMaximized

请注意, 总是Windows(1)活动窗口。Note that the active window is always Windows(1).

窗口标题是窗口未最大化时窗口顶部的标题栏中显示的文本。The window caption is the text shown in the title bar at the top of the window when the window isn't 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 doesn't change the name of the workbook.

下例为“Book1.xls:1”窗口中显示的工作表关闭单元格网格线。The following example turns off cell gridlines for the worksheet shown in the Book1.xls:1 window.

Windows("book1.xls":1).DisplayGridlines = False



另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.