Window Properties

Name

Returns

Description

ActiveCell

Range

Read-only. Returns the cell in the window where the cursor is

ActiveChart

Chart

Read-only. Returns the currently selected chart in the window. If no chart is currently selected, nothing is returned

ActivePane

Pane

Read-only. Returns the active pane in the window

ActiveSheet

Object

Read-only. Returns the active sheet in the window

ActiveSheet View

Object

Read-only. Returns a view of the active sheet in the window

AutoFilter DataGrouping

Boolean

Set/Get whether the auto filter for date grouping is currently displayed in the specified window

Caption

Variant

Set/Get the caption that appears in the window

Display Formulas

Boolean

Set/Get whether formulas are displayed in the window. Not valid in a Chart sheet

Display Gridlines

Boolean

Set/Get whether worksheet gridlines are displayed

Compare Boolean

SideBySideWith

Name

Returns

Description

Display Headings

Boolean

Set/Get whether row and column headings are displayed. Not valid in a Chart sheet

Display

Horizontal

ScrollBar

Boolean

Set/Get whether the horizontal scrollbar is displayed in the window

Display Outline

Boolean

Set/Get whether outline symbols are displayed

Display RightToLeft

Boolean

Set/Get whether the window contents are displayed from right to left. Valid only with languages that support right-to-left text

DisplayRuler

Boolean

Set/Get whether a ruler is displayed for the specified window

Display

Vertical

ScrollBar

Boolean

Set/Get whether the vertical scrollbar is displayed in the window

Display Whitespace

Boolean

Set/Get whether whitespace is displayed

Display WorkbookTabs

Boolean

Set/Get whether workbook tabs are displayed

DisplayZeros

Boolean

Set/Get whether zero values are displayed. Not valid with Chart sheets

EnableResize

Boolean

Set/Get whether a user can resize the window

FreezePanes

Boolean

Set/Get whether split panes are frozen. Not valid with Chart sheets

GridlineColor

Long

Set/Get the color of the gridlines. Use the RGB function to create the color value

GridlineColor Index

XlColor Index

Set/Get the color of the gridlines. Use the XlColorIndex constants or an index value in the current color palette

Height

Double

Set/Get the height of the window

Index

Long

Read-only. Returns the spot in the collection where the current object is located

Left

Double

Set/Get the distance from the left edge of the client area to the window's left edge

OnWindow

String

Set/Get the name of the procedure to run whenever a window is activated

Name

Returns

Description

Panes

Panes

Read-only. Returns the panes that are contained in the window

Range Selection

Range

Read-only. Returns the selected range of cells or objects in the window

ScrollColumn

Long

Set/Get the column number of the leftmost column in the window

ScrollRow

Long

Set/Get the row number of the topmost row in the window

Selected Sheets

Sheets

Read-only. Returns all the selected sheets in the window

Selection

Object

Read-only. Returns the selected object in the window

SheetViews

SheetViews

Read-only. Returns the SheetViews object for a given window

Split

Boolean

Set/Get whether the window is split into panes

SplitColumn

Long

Set/Get at which column number the window split is going to be located

Split

Horizontal

Double

Set/Get where the horizontal split of window will be located, in points

SplitRow

Long

Set/Get at which row number the window split is going to be located

SplitVertical

Double

Set/Get where the vertical split of window will be located, in points

TabRatio

Double

Set/Get how big a workbook's tab is, as a ratio of a workbook's tab area width to the window's horizontal scrollbar width

Top

Double

Set/Get the distance from the top edge of the client area to the window's top edge

Type

XlWindow Type

Read-only. Returns the window type

UsableHeight

Double

Read-only. Returns the maximum height that the window can be

UsableWidth

Double

Read-only. Returns the maximum width that the window can be

View

XlWindow View

Set/Get the view in the window (for example, xlNormalView and xlPageBreakPreview)

Visible

Boolean

Set/Get whether the window is visible

Name

Returns

Description

VisibleRange

Range

Read-only. Returns the range of cells that are visible in the current window

Width

Double

Set/Get the width of the window

WindowNumber

Long

Read-only. Returns the number associated with a window. Typically used when the same workbook is opened twice (for example, MyBook.xlsx:1 and MyBook.xlsx:2)

WindowState

XlWindow State

Set/Get the state of the window: minimized, maximized, or normal

Zoom

Variant

Set/Get the percentage of window zoom

ndow Methods

Name

Returns

Parameters

Description

Activate

Variant

Sets focus to the window

ActivateNext

Variant

Activates the next window in the z-order

ActivatePrevious

Variant

Activates the previous window in the z-order

Close

[Filename],

[RouteWorkbook]

Closes the window. Set SaveChanges to True to automatically save changes in the window's workbook. If SaveChangesis False, then all changes are lost. The Filename parameter can be used to specify the filename to save to. RouteWorkbook is used to automatically route the workbook onto the next recipient, if applicable

LargeScroll

[ToRight], [ToLeft]

Causes the document to scroll a certain direction a screenful at a time, as specified by the parameters

NewWindow

Window

Creates and returns a new window

Name

Returns

Parameters

Screen

PixelsX

Long

Points As Long

Converts the horizontal document coordinate Points parameter to screen coordinate pixels

PointsTo

Screen

PixelsY

Long

Points As Long

Converts the vertical document coordinate Points parameter to screen coordinate pixels

Printout

Variant

[From], [To], [Copies], [Preview], [Active Printer], [PrintToFile], [Collate], [PrToFile Name]

Prints out the document in the window. The printer, number of copies, collation, and whether a print preview is desired can be specified with the parameters. Also, the sheets can be printed to a file using the PrintToFile and PrToFileName parameters. The From and To parameters can be used to specify the range of printed pages

PrintPreview

Variant

[Enable Changes]

Displays the current workbook in the window in a print preview mode. Set the EnableChanges parameter to False to disable the Margins and Setup buttons, hence not allowing the viewer to modify the page setup

RangeFrom Point

Object

x As Long, y As Long

Returns the shape or range located at the x and y coordinates. Returns nothing if there is no object at the x, y coordinates

ScrollInto View

Left As Long, Top As Long, Width As Long, Height As Long, [Start]

Scrolls the spot specified by the Left, Top, Width, and Height parameters to either the upper-left corner of the window (Start = True) or the lower-right corner of the window (Start = False). The Left, Top, Width, and Height parameters are specified in points

ScrollWorkbook Tabs

Variant

[Sheets], [Position]

Scrolls through the number of sheets specified by the Sheets

parameter, or goes to the sheet specified by the position parameter (xlFirst or xlLast)

Name

Returns

Parameters

Description

SmallScroll

[ToRight], [ToLeft]

Causes the document to scroll a certain direction one document line at a time, as specified by the parameters

Window Object and the Windows Collection Example

Sub MinimizeAllWindows() Dim oWin As Window For Each oWin In Windows

Sub MinimizeAllWindows() Dim oWin As Window For Each oWin In Windows

'Minimize all workbooks that are not hidden If oWin.Visible = True Then oWin.WindowState = xlMinimized End If Next End Sub

0 0

Post a comment