<< Click to Display Table of Contents >> Window (object) |
Access paths:
▪Application à Windows à Item
▪Application à ActiveWindow
▪Application à Workbooks à Item à ActiveWindow
▪Application à ActiveWorkbook à ActiveWindow
1 Description
A Window object represents one individual document window that is currently open in PlanMaker.
An individual Window object exists for each document window. If you open or close document windows, the respective Window objects will be created or deleted dynamically.
2 Access to the object
The individual Window objects can be accessed in any of the following ways:
▪All open document windows are managed in the Application.Windows collection (type: Windows):
' Show the names of all open document windows
For i = 1 To pm.Application.Windows.Count
MsgBox pm.Application.Windows.Item(i).Name
Next i
▪You can access the currently active document window through Application.ActiveWindow:
' Show the name of the active document window
MsgBox pm.Application.ActiveWindow.Name
▪The object Workbook contains an object pointer to the respective document window:
' Access the active document window through the active document
MsgBox pm.Application.ActiveWorkbook.ActiveWindow.Name
3 Properties, objects, collections and methods
▪FullName R/O
▪Name R/O
▪Path R/O
▪Left
▪Top
▪Width
▪Height
▪WindowState
▪DisplayFormulas
▪DisplayVerticalScrollBar
▪DisplayHorizontalScrollBar
▪DisplayWorkbookTabs
▪DisplayHeadings
▪Zoom
▪DisplayGridlines
▪GridlineColor
▪GridlineColorIndex
Objects:
▪Workbook → Workbook
▪ActiveCell → Range
▪ActiveSheet → Sheet
▪Application → Application
▪Parent → Windows
Methods:
▪Activate
▪Close
FullName (property, R/O)
Data type: String
Returns the path and file name of the document opened in the window (e.g., "c:\Documents\Smith.pmdx").
Name (property, R/O)
Data type: String
Returns the file name of the document opened in the window (e.g., "Smith.pmdx").
Path (property, R/O)
Data type: String
Returns the path of the document opened in the window (e.g., "c:\Documents").
Left (property)
Data type: Long
Gets or sets the horizontal position of the window, measured in screen pixels.
Top (property)
Data type: Long
Gets or sets the vertical position of the window, measured in screen pixels.
Width (property)
Data type: Long
Gets or sets the width of the window, measured in screen pixels.
Height (property)
Data type: Long
Gets or sets the height of the window, measured in screen pixels.
WindowState (property)
Data type: Long (SmoWindowState)
Gets or sets the state of the document window. The possible values are:
smoWindowStateNormal = 1 ' normal
smoWindowStateMinimize = 2 ' minimized
smoWindowStateMaximize = 3 ' maximized
DisplayFormulas (property)
Data type: Boolean
Gets or sets the setting whether table cells containing calculations should display the result or the formula of the calculation.
DisplayVerticalScrollBar (property)
Data type: Boolean
Gets or sets the setting whether a vertical scroll bar should be shown on the righthand side of the document window. Corresponds to the setting "Vertical scrollbar" on the Options tab in the dialog box of the ribbon command File | Properties.
DisplayHorizontalScrollBar (property)
Data type: Boolean
Gets or sets the setting whether a horizontal scroll bar should be shown at the bottom of the document window. Corresponds to the setting "Horizontal scrollbar" on the Options tab in the dialog box of the ribbon command File | Properties.
DisplayWorkbookTabs (property)
Data type: Boolean
Gets or sets the setting whether worksheet tabs should be displayed at the bottom of the document window. Corresponds to the setting "Sheet tabs" on the Options tab in the dialog box of the ribbon command File | Properties.
DisplayHeadings (property)
Data type: Boolean
Gets or sets the setting whether row and column headers should be displayed in the document window. Corresponds to the ribbon command View | Row and column headers.
Notes:
▪This property is supported by PlanMaker only for Excel compatibility reasons. It is recommended to use the DisplayRowHeadings and DisplayColumnHeadings properties in the Sheet object instead, because these settings can be made independently for each worksheet and allow you to enable/disable row and column headers individually
▪If you retrieve this property while multiple worksheets exist where this setting has different values, the value smoUndefined will be returned.
Zoom (property)
Data type: Long
Gets or sets the zoom level of the document window. Allowed are values between 50 and 400. They represent the zoom level in percent.
Alternatively, you can use the constant pmZoomFitToSelection which adapts the zoom level to the current selection.
Example:
' Set the zoom level to 120%
pm.ActiveWindow.Zoom = 120
Note: Changes to this setting affect only the current worksheet. If you want to change the zoom level of other worksheets as well, you have to make them the active worksheet first.
DisplayGridlines (property)
Data type: Boolean
Gets or sets the setting whether grid lines should be displayed in the document window. Corresponds to the "Gridlines" setting in the Insert | Tables group | Sheet | Properties dialog box of the ribbon command - except that the gridlines of all worksheets in the document are affected.
Notes:
▪This property is supported by PlanMaker only for Excel compatibility reasons. It is recommended to use the identically named property in the Sheet object instead, as it allows you to change this setting for each worksheet individually.
▪If you retrieve this property while multiple worksheets exist where this setting has different values, the value smoUndefined will be returned.
GridlineColor (property)
Data type: Long (SmoColor)
Gets or sets the color of the grid lines as a "BGR" value (Blue-Green-Red triplet). You can either indicate an arbitrary value or use one of the pre-defined BGR color constants.
Notes:
▪This property is supported by PlanMaker only for Excel compatibility reasons. It is recommended to use the identically named property in the Sheet object instead, as it allows you to change this setting for each worksheet individually.
▪If you retrieve this property while multiple worksheets exist where this setting has different values, the value smoUndefined will be returned.
GridlineColorIndex (property)
Data type: Long (SmoColorIndex)
Gets or sets the color of the grid lines as an index color. "Index colors" are the standard colors of PlanMaker, consecutively numbered from -1 for transparent to 15 for light gray. You may use the values shown in the Index colors table.
Notes:
▪This property is supported by PlanMaker only for Excel compatibility reasons. It is recommended to use the identically named property in the Sheet object instead, as it allows you to change this setting for each worksheet individually.
▪If you retrieve this property while multiple worksheets exist where this setting has different values, the value smoUndefined will be returned.
Workbook (pointer to object)
Data type: Object
Returns the Workbook object assigned to this document window. With this you can read and set numerous settings of your document.
ActiveCell (pointer to object)
Data type: Object
Returns a Range object that represents the active cell in this document window. You can use this object to read and edit the formatting and content of the cell.
Please note that ActiveCell always returns just one single cell, even if a range of cells is selected in the worksheet. After all, selected ranges have exactly one active cell as well. You can see that when you select cells and then press the Enter key: a cell frame appears within to selection to indicate the active cell.
ActiveSheet (pointer to object)
Data type: Object
Returns a Sheet object that represents the worksheet active in this document window. With this object you can read and edit the settings of the worksheet.
Application (pointer to object)
Data type: Object
Returns the Application object.
Parent (pointer to object)
Data type: Object
Returns the superordinate object, i.e. Windows.
Activate (method)
Brings the document window to the foreground (if the property Visible for this document is True) and sets the focus to it.
Syntax:
Activate
Parameters:
none |
Return type:
none |
Example:
' Activate the first document window
pm.Windows(1).Activate
Close (method)
Closes the document window.
Syntax:
Close [SaveChanges]
Parameters:
SaveChanges (optional; type: Long or SmoSaveOptions) indicates whether the document opened in the window should be saved or not (if it was changed since last save). If you omit this parameter, the user will be asked to indicate it (if necessary). The possible values for SaveChanges are: |
smoDoNotSaveChanges = 0 ' Don't ask, don't save
smoPromptToSaveChanges = 1 ' Ask the user
smoSaveChanges = 2 ' Save without asking
Return type:
none |
Example:
' Close the active document window, without saving
pm.ActiveWindow.Close smoDoNotSaveChanges