Whenever possible, create macros in Modules. Doing so will add to the integrity and stability of your program. The exception to this rule is event procedures, which are added directly to InfoConnect objects.
To create a macro in the Visual Basic Editor
In InfoConnect, open a session document.
The steps depend on your user interface mode.
User Interface Mode |
Steps |
---|---|
InfoConnect Ribbon |
For IBM3270 and IBM5250 terminals: On the Macrosribbon, from the Advancedgroup, clickVisual Basic. For all other terminals: On the Tools ribbon, in the Macros group, click Visual Basic. |
InfoConnect Browser |
On the InfoConnect menu, choose Tools, Macroand then Visual Basic. |
TouchUX |
Tap the Wrench icon and then under Macro, select Visual Basic. |
Classic MDI |
From the Macro menu, select Visual Basic Editor. |
The session document appears as a project in the Project Explorer; for example, Project (My Session.rd3x).
In the Project Explorer, select the project in which you want save the macro, and then choose Insert > Module to create a new module.
Double-click the module you created.
The Codewindow opens.
Choose Insert> Procedure, type a name in the Namebox, and then click OK.
The name you choose must follow the Visual Basic naming conventions for macros. For further information, see Naming Macros.
Type code for your macro between the Sub (or Public Sub) and End Sub statements.
Context-sensitive Help is available for Visual Basic commands. Position the insertion point within a command and press F1.