Window Object

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.


Aa191126.parchild(en-us,office.10).gifWindow
Aa191126.space(en-us,office.10).gifAa191126.parchild(en-us,office.10).gif

Represents a window. Many worksheet characteristics, such as scroll bars and gridlines, are actually properties of the window. The Window object is a member of the Windows collection. Each worksheet has a unique Window object. Code can only access the window for the active sheet of the workbook. In other words, although the Windows collection states that there is only one Window object, there are, in fact, multiple Window objects, but you may only access the Window object for the active sheet.

Using the Window object

The following properties return a Window object.

The Spreadsheet object's ActiveWindow property.

The Windows collection's Item property.

The following example hides the row and column headings in the active window of Spreadsheet1.

`

Sub HideHeadings()

Spreadsheet1.ActiveWindow.DisplayColumnHeadings = False Spreadsheet1.ActiveWindow.DisplayRowHeadings = False

End Sub

`

The following example moves column C so that it's the leftmost column in the window.

  Spreadsheet1.ActiveWindow.ScrollColumn = 3