3.3 Centrally Manage VBA Macros

You can use two different approaches to centrally control and manage InfoConnect Desktop VBA macros.

  • You can save VBA macros in the SharedMacros.rd3x, SharedMacros.rd5x, SharedMacros.rdox, SharedMacros.ialc, SharedMacros.iuts, or SharedMacros.it27 files and deploy them to the user data folder. When a session opens, it automatically loads the macros from the SharedMacros file that corresponds to it’s file type. (See Walkthrough: Set up and deploy a SharedMacros file)

  • You can save VBA macros in session document files that reside on a network share or other location and then configure local session documents to reference these shared documents. When the local session documents open, they load the macros from the documents that they reference. (See Walkthrough: Set up a Session to Reference Macros in a Shared Session Document File )

InfoConnect Desktop supports using SharedMacros files and referencing session documents that contain VBA macros for IBM (.rd5x and .rd3x), VT (.rdox), Unisys (.iuts), T27 (.it27), and ALC (.ialc) session documents. You’ll need to create at least one session document file for each type of terminal you are using. Session document files can only reference macros in the same type of session document. For example, IBM3270 sessions can only reference session documents with an .rd3x extension.

NOTE:InfoConnect does not support nested references to session documents. If a session references a session document that in turn references other session documents, the references in the second session document are ignored.

If you are referencing session documents or using SharedMacros files to share macros, make sure the projects in those files have unique project names. Each project name in the VBA Project editor must be unique to avoid errors caused by naming conflicts. You can change project names by modifying the project properties in the VBA editor or by creating and saving these files in InfoConnect Desktop 17.0 SP1.

Using SharedMacros files

Referencing macros in shared session document files

Use this approach when

You want to share macros with every session file of a specific terminal type (for example, all IBM3270 session files).

You want to share macros only with specific session document files.

You want to centrally manage macros by saving them in session document files that reside on a network share or other location. Saving the session file on a share allows you to change the macros on the user’s machines without deploying any files.

NOTE:When a local session with a reference to a shared session document file opens, it downloads the latest versions of the macros in the shared document.

You’ll need to

Develop the macros you want to share and save them in one of the following session document files:

SharedMacros.rd3x, SharedMacros.rd5x, SharedMacros.rdox, SharedMacros.ialc, SharedMacros.iuts, SharedMacros.it27

Deploy the SharedMacros file to the user data folder.

Develop the macros you want to reference and save them in a session document file on a network share or another location.

Set up custom session documents that reference the session documents that contain the macros and deploy them to users.

If the location you save the session documents on is not a trusted location, you’ll need to add it to the list of trusted locations and deploy that setting to users.

Considerations

If you want to modify any of the macros in the SharedMacros files, you’ll need to deploy these files to users.

To prevent users from editing the macro source in the shared session documents referenced by other sessions, consider locking and password-protecting the macro projects or using some other method to control access to these files.

NOTE:When you save a macro that was downloaded from a reference session in a local session, the modified macro source is automatically uploaded to the referenced session document.

NOTE:Prior to InfoConnect Desktop version 16-2, Visual Basic code was shared by exporting and distributing code module (.bas), class (.cls), and form (.frm) files that could then be imported into user session document files. This method for sharing macros is still supported. However, for new implementations, it is recommended to share macros either by including them in the SharedMacros files or by referencing session documents that contain the shared macros.