Document Events

Ribbon bar. Select the Home tab. In the Tools group, click Macro and from the ApplicationEvents submenu, select View Code to display the Document Events window.

Classic menus. From the View - Events submenu or from the Tools - Macro - Application Events submenu, select View Code to display the Document Events window.

The Document Events window is similar in appearance to that of a regular Statistica Visual Basic macro window and operates in the same manner; the body of the dialog box fully supports Statistica Visual Basic editing and debugging.

The Document Events window comprises several basic components:

Object
The Object box contains two options, (General) and Document. These options toggle between document and global events.
Proc(edure)
If the Object box is set to (General) you are able to enter global variables, external library inclusions, and API declarations.

If the Object box is set to Document, the Proc box will contain a list of possible events for the current document or application. Simply select the event that you want to edit from the Proc box (e.g. OnInit). The corresponding function will then be written into the body of the Document Events window; the function's parameters will be automatically entered for you, so all you will need to do is enter events into the body of the function. These functions will also automatically be mapped to the respective message within the Statistica environment (i.e. a spreadsheet's OnClose function will immediately be associated with the event of the spreadsheet being closed). Because of this message mapping, you do not explicitly call these functions from within Statistica, but rather they will execute when their associated message (i.e. double clicking, creating a workbook, etc.) occurs.

Visual Basic edit field. Use this field to enter your Statistica Visual Basic code. Note that while you are entering your code, if you highlight a keyword and press F1, WinWrap help® will be displayed.

See Macro (SVB) Programs Window Overview for additional information regarding the debug pane of the Document Events window.