Skip to content

Centrally Manage VBA Macros

With Reflection Desktop 16.2 (and greater), you can use two different approaches to centrally control and manage Reflection Desktop VBA macros.

  • You can save VBA macros in the SharedMacros.rd3x, SharedMacros.rd5x, or SharedMacros.rdox 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 to 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 to Set up a Session to Reference Macros in a Session Document File )

Sharing Macros in Session Documents

Reflection Desktop supports using SharedMacros files and referencing session documents that contain VBA macros for IBM ( .rd5x and .rd3x) and VT ( .rdox) 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 .rd3xextension.

note

Reflection 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 Reflection Desktop 16.2 or greater.

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 session document file opens, it downloads the latest versions of the macros from the document that it references.
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

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 documents that contain the macros and deploy them to users.

If the location you save the session documents on is not a trusted location, youRSQUOll 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 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 referenced session in a local session, the modified macro source is automatically uploaded to the referenced session document.

note

Prior to Reflection 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.