The Visual Basic window

What you can do

When you create a VBA event handler for FORMS, click Code to edit VBA source code. The Visual Basic window is displayed.

In the Visual Basic window you can:

All VBA code is color-coded as you type it. Which words are color-coded and which colors are used is controlled by FORMS5_VBA.ini, a file located in the program directory, normally C:\Program Files\ReadSoft\FORMS\Bin.

All predefined constants used in the VBA editor (for example VB_OK) are color-coded blue. If an undefined constant is used, no compilation error or warning is displayed. It is defined as 0 and the color changes to black.

The maximum file size is 64 kB.

The File menu

The File menu has these commands:

Command

Description

Load

Loads a file into the edit window.

Save and exit

Closes the window and saves any changes made.

Save as

Saves the contents of the edit window to a file.

Cancel

Closes the window without saving any changes.

The Compile menu

The Compile menu has these commands:

Command

Description

Compile

Compiles the contents of the edit window. Compilation errors appear in a dialog that contains information about the errors. If compilation is successful, Run is activated.

Run

The VBA function for the event is called. Note that if no function is named in the Event details dialog, nothing happens when you select Run.

Event handlers with parameters report execution errors when you try to execute them. This is because they must be called and receive proper parameters from other FORMS modules. The Manager does not provide any parameters, and this causes runtime errors.

The Help menu

On the Help menu you can choose one of these types of help:

Command

Description

Help on VBA

Opens Cypress Enable Language Reference, a PDF document that contains VBA programming information. Available in English only.

Help on methods and events

This help file. Available in English only.

Defining event handlers

Customizing FORMS: Events