Class Window (Excel VBA)
The class Window represents a window.
The classes Application and Workbook. give access to class Window
Dim wnd as Window
Set wnd = ActiveWindow
For Each
Here is an example of processing the Window items in a collection.
Dim wnd As Window
For Each wnd In Windows
Next wnd
Methods
Activate - Brings the window to the front of the z-order.
ActiveWindow.Activate
ActivateNext - Activates the specified window and then sends it to the back of the window z-order.
ActivatePrevious - Activates the specified window and then activates the window at the back of the window z-order.
Close - Closes the object.
LargeScroll - Scrolls the contents of the window by pages.
NewWindow - Creates a new window or a copy of the specified window.
PointsToScreenPixelsX - Converts a horizontal measurement from points (document coordinates) to screen pixels (screen coordinates). Returns the converted measurement as a Long value.
PointsToScreenPixelsY - Converts a vertical measurement from points (document coordinates) to screen pixels (screen coordinates). Returns the converted measurement as a Long value.
PrintOut - Prints the object.
PrintPreview - Shows a preview of the object as it would look when printed.
RangeFromPoint - Returns the Shape or Range shape that is positioned at the specified pair of screen coordinates. If there isn't a shape located at the specified coordinates, this method returns Nothing.
ScrollIntoView - Scrolls the document window so that the contents of a specified rectangular area are displayed in either the upper-left or lower-right corner of the document window or pane (depending on the value of the Start argument).
ScrollWorkbookTabs - Scrolls through the workbook tabs at the bottom of the window. Doesn't affect the active sheet in the workbook.
SmallScroll - Scrolls the contents of the window by rows or columns.
Properties
ActiveCell returns a Range object that represents the active cell in the active window (the window on top) or in the specified window. If the window isn't displaying a worksheet, this property fails.
ActiveChart returns a Chart object that represents the active chart (either an embedded chart or a chart sheet). An embedded chart is considered active when it's either selected or activated. When no chart is active, this property returns Nothing.
ActivePane returns a Pane object that represents the active pane in the window.
ActiveSheet returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns Nothing if no sheet is active.
ActiveSheetView returns an object that represents the view of the active sheet in the specified window.
AutoFilterDateGrouping true if the auto filter for date grouping is currently displayed in the specified window.
Caption returns or sets a Variant value that represents the name that appears in the title bar of the document window.
DisplayFormulas true if the window is displaying formulas; False if the window is displaying values.
DisplayGridlines true if gridlines are displayed.
DisplayHeadings true if both row and column headings are displayed; False if no headings are displayed.
DisplayHorizontalScrollBar true if the horizontal scroll bar is displayed.
DisplayOutline true if outline symbols are displayed.
DisplayRightToLeft true if the specified window is displayed from right to left instead of from left to right. False if the object is displayed from left to right.
DisplayRuler true if a ruler is displayed for the specified window.
DisplayVerticalScrollBar true if the vertical scroll bar is displayed.
DisplayWhitespace true if whitespace is displayed.
DisplayWorkbookTabs true if the workbook tabs are displayed.
DisplayZeros true if zero values are displayed.
EnableResize true if the window can be resized.
FreezePanes true if split panes are frozen.
GridlineColor returns or sets the gridline color as an RGB value.
GridlineColorIndex returns or sets the gridline color as an index into the current color palette or as an XlColorIndex constant.
Height returns or sets a Double value that represents the height, in points, of the window.
Hwnd returns a Long that indicates the window handle of the specified window.
Index returns a Long value that represents the index number of the object within the collection of similar objects.
Left returns or sets a Double value that represents the distance, in points, from the left edge of the client area to the left edge of the window.
OnWindow returns or sets the name of the procedure that's run whenever you activate a window.
Panes returns a Panes collection that represents all the panes in the specified window.
RangeSelection returns a Range object that represents the selected cells on the worksheet in the specified window even if a graphic object is active or selected on the worksheet.
ScrollColumn returns or sets the number of the leftmost column in the pane or window.
ScrollRow returns or sets the number of the row that appears at the top of the pane or window.
SelectedSheets returns a Sheets collection that represents all the selected sheets in the specified window.
Selection returns the specified window, for a Windows windows.
SheetViews returns the SheetViews object for the specified window.
Split true if the window is split.
SplitColumn returns or sets the column number where the window is split into panes (the number of columns to the left of the split line).
SplitHorizontal returns or sets the location of the horizontal window split, in points.
SplitRow returns or sets the row number where the window is split into panes (the number of rows above the split).
SplitVertical returns or sets the location of the vertical window split, in points.
TabRatio returns or sets the ratio of the width of the workbook's tab area to the width of the window's horizontal scroll bar (as a number between 0 (zero) and 1; the default value is 0.6).
Top returns or sets a Double value that represents the distance, in points, from the top edge of the window to the top edge of the usable area (below the menus, any toolbars docked at the top, and the formula bar).
Type returns or sets an XlWindowType value that represents the window type.
UsableHeight returns the maximum height of the space that a window can occupy in the application window area, in points.
UsableWidth returns the maximum width of the space that a window can occupy in the application window area, in points.
View returns or sets the view showing in the window.
Visible returns or sets a Boolean value that determines whether the object is visible.
VisibleRange returns a Range object that represents the range of cells that are visible in the window or pane. If a column or row is partially visible, it's included in the range.
Width returns or sets a Double value that represents the width, in points, of the window.
WindowNumber returns the window number. For example, a window named Book1.xls:2 has 2 as its window number. Most windows have the window number 1.
WindowState returns or sets the state of the window.
Zoom returns or sets a value that represents the display size of the window, as a percentage (100 equals normal size, 200 equals double size, and so on).
Related Classes
Chart - Represents a chart in a workbook.
Pane - Represents a pane of a window.
Panes - A collection of all the Pane objects shown in the specified window.
Range - Represents a cell, a row, a column, a selection of cells containing one or more contiguous blocks of cells, or a 3D range.
Shape - Represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, or picture.
Sheets - A collection of all the sheets in the specified or active workbook.
SheetViews - A collection of all the sheet views in the specified or active workbook window.
Windows - A collection of all the Window objects in Microsoft Excel.
Worksheet - Represents a worksheet.
WorksheetView - An object that defines the behavior of a single worksheet view.