Reflection Desktop VBA Guide
Key Concepts / Sharing and Referencing Macros
In This Topic
    Sharing and Referencing Macros
    In This Topic

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

    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 reference only macros in the same type of session document. For example, IBM3270 sessions can reference only session documents with an .rd3x extension.
    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. See Understanding VBA Project Components.

                    Using SharedMacros files Referencing session document files that contain shared macros
    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 (such as a folder on a workstation that is available to all users). 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.
    To use this approach, you'll need to... Develop the macros you want to share and save them in one of the following session document files:


    Deploy the SharedMacros file to the user data folder.
    Develop the macros you want to share 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 these custom session documents to users.

    If the location you save the session documents that contain the macro source 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 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 .   

    The default user data directory is C:\Users\username\Documents\Micro Focus\Reflection\

    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.

    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.

    For more about shared macros, see Set up Shared VBA Macros in the Reflection Deployment Guide.