Run VB or VBA

This topic provides you with information about the VB and VBA Scripts operation.

This page discusses:

See Also
Command
Open URL
System

Accessing this Operation

This operation can be accessed by clicking VB and VBA Scripts .

Describing this Operation

This operation is designed to run a VBScript or a VBA project to call a specified routine located in a specified module. The operation and the type can be arguments of the macro, thus enabling you to use Know-how Apps Components automation interfaces (used to manage arguments) directly on the operation.

  • VB Script: The operation can be passed as an argument for Scripts (Run VB or VBA) enabling you to retrieve the VB and VBA Scripts Operation inputs. The extended object is also passed as a second argument. These 2 arguments are optional. You can call a function that takes no arguments, only 1 (in this case it is always the operation), or 2 arguments (the operation and the extended object.) You can also specify the routine name to call. By default, if no routine is specified, the CATMain is launched.
  • VBA: You can reference an external catvba, and specify the module name and the routine to run. As for VB Script, the operation itself and the extended object can be optional arguments for the called routine.

More Information

When a VB and VBA Scripts Operation launches a VBA with a non modal tab, ShowModal=false, the next operation can start before the VBScript ends. To by-pass the problem:

  1. Add an OUT integer variable named SYNCVBANonModal to the VB and VBA Scripts Operation.
  2. In the launched routine, store a global reference to the variable.
  3. At the very end of the script (when the tab closes), write something in the variable.

Using this Operation Interface

Name Name attributed to the operation.
Comment Comment attributed to the operation.
Macro Language VB: Reference a CATScript.
VBA: Reference a catvba.
Macro Name Type the name of the resource table entry pointing to the VB or the VBA script that you want to use. Click to open the resource table. Click Edit to launch the VB/VBA editor.
Routine Name Type the name of the routine to launch. By default, if no routine name is specified, the CATMain of the specified module is called. Two arguments can be provided to the called routine: The operation itself (equivalent of this object) and the extended object. With the Script Operation itself as an argument, you can directly access the operation in your macro, allowing you to call Know-how Apps Components automation methods to valuate and retrieve operations parameters.
Defined inputs and parameters Click Add/Modify/Delete to define/modify/delete the inputs and the parameters that retrieved using the exposed automation methods.

Using this Operation

A document is associated with the process that is being developed by the expert user. The expert user wants the end user to access this documentation.