GET.WINDOW

Macro Sheets Only

Returns information about a window. Use GET.WINDOW in a macro that requires the status of a window, such as its name, size, position, and display options.

Syntax

GET.WINDOW(type_num, window_text)

Type_num is a number that specifies what type of window information you want. The following list shows the possible values of type_num and the corresponding results:

Type_num Returns

1 Name of the workbook and sheet in the window as text. For compatibility with Microsoft Excel 4.0, if the window contains only a single sheet that has the same name as the workbook without its extension, returns only the name of the book. Otherwise, returns the name of the sheet in the form "[Book1]Sheet1".

2 Number of the window.

3 X position, measured in points from the left edge of the workspace (in Microsoft Excel for Windows) or screen (in Microsoft Excel for the Macintosh) to the left edge of the window.

4 Y position, measured in points from the bottom edge of the formula bar to the top edge of the window.

5 Width, measured in points.

6 Height, measured in points.

7 If window is hidden, returns TRUE; otherwise, returns FALSE.

The rest of the values for type_num apply only to worksheets and macro sheets, except where indicated:

Type_num Returns

8 If formulas are displayed, returns TRUE; otherwise, returns FALSE.

9 If gridlines are displayed, returns TRUE; otherwise, returns FALSE.

10 If row and column headings are displayed, returns TRUE; otherwise, returns FALSE.

11 If zeros are displayed, returns TRUE; otherwise, returns FALSE.

12 Gridline and heading color as a number in the range 1 to 56, corresponding to the colors in the View tab of the Options dialog box; if color is automatic, returns 0.

Values 13 to 16 for type_num return arrays that specify which rows or columns are at the top and left edges of the panes in the window and the widths and heights of those panes.

Type_num Returns

13 Leftmost column number of each pane, in a horizontal numeric array

14 Top row number of each pane, in a horizontal numeric array.

15 Number of columns in each pane, in a horizontal numeric array.

16 Number of rows in each pane, in a horizontal numeric array.

17 Number indicating the active pane:
1 = Upper, left, or upper-left
2 = Right or upper-right
3 = Lower or lower-left
4 = Lower-right

18 If window has a vertical split, returns TRUE; otherwise, returns FALSE.

19 If window has a horizontal split, returns TRUE; otherwise, returns FALSE.

20 If window is maximized, returns TRUE; otherwise, returns FALSE.

21 Reserved

22 If the Outline Symbols check box is selected in the View tab of the Options dialog box, returns TRUE; otherwise, returns FALSE.

23 Number indicating the size of the window (including charts):
1 = Restored
2 = Minimized (displayed as an icon)
3 = Maximized

24 If panes are frozen on the active window, returns TRUE; otherwise, returns FALSE.

25 The numeric magnification of the active window (as a percentage of normal size) as set in the Zoom dialog box, or 100 if none is specified.

26 Returns TRUE if horizontal scrollbars are displayed in the active window; otherwise, returns FALSE.

27 Returns TRUE if vertical scrollbars are displayed in the active window; otherwise, returns FALSE.

28 Returns the tab ratio of workbook tabs to horizontal scrollbar, from 0 to 1. The default is .6.

29 Returns TRUE if workbook tabs are displayed in the active window; otherwise, returns FALSE.

30 Returns the title of the active sheet in the window in the form "[book1]sheet1".

31 Returns the name of a workbook only, without read/write indicated. For example, if Book1.xls is read only, then "Book.xls" will be returned without "[Read Only]" appended.

Window_text is the name that appears in the title bar of the window that you want information about. If window_text is omitted, it is assumed to be the active window.

Examples

If the active window contains the workbook Book1, then:

GET.WINDOW(1) equals "Book1"

If the title of the active window is Macro1:3, then:

GET.WINDOW(2) equals 3

In Microsoft Excel for Windows, the following macro formula returns the gridline and heading color of REPORT.XLS:


GET.WINDOW(12, "REPORT.XLS")

In Microsoft Excel for the Macintosh, the following macro formula returns the gridline and heading color of REPORT MASTER:


GET.WINDOW(12, "REPORT MASTER")

Related Functions

GET.DOCUMENT Returns information about a document

GET.WORKSPACE Returns information about the workspace

List of Information Functions