Reflection Desktop VBA Guide
Key Concepts / Using Legacy Macros
In This Topic
    Using Legacy Macros
    In This Topic

    You can run legacy Reflection and EXTRA! macros in Reflection. You can also use tools provided by Reflection to edit EXTRA! Basic macros, legacy Reflection Basic macros, and legacy Reflection VBA macros.

    Some properties and methods are not supported. If the macro contains unsupported objects, its functionality may be limited or it may not run.

    Running Legacy Reflection and EXTRA! Macros

    Editing Legacy Reflection Macros

    Editing Legacy EXTRA! Macros

    Running Legacy Reflection and EXTRA! Macros

    You can open a settings file in the workspace to run the macros it contains, or you can run macros from an external file. Reflection supports the following macro file formats:

    You can run RCL scripts only when a VT session document is active in the workspace.

    To run a legacy Reflection macro in a settings or session file

    Note: Legacy macro options are available only if compatibility features are installed.
    1. Open the legacy settings file in Reflection.
    2. On the Session ribbon, from the Macros group, click Run Macro.
    3. From the Run Macro dialog box, select Legacy Reflection Macro in This File.
    4. In the Macros dialog, select the macro name and click Run.
      Note: These macros include legacy settings files (.rsf, .r2w, or .r4w) and session documents (.rd3x, .rd5x, .rdox) that were previously converted from settings files.

    To run a legacy macro from an external file

    Note: Legacy macro options are available only if compatibility features are installed.
    1. On the Reflection button, select Reflection Workspace Settings.
    2. Under Trust Center, select Set up API and Macro Security.
    3. In the Legacy API Preference list, select Reflection or EXTRA!.
    4. Close the workspace and then reopen it.
    5. If your legacy macro was created in Reflection 10.x or earlier, open and save it in Reflection 14.x.
    6. Open a session.
    7. On the Session ribbon, from the Macros group, click Run Macro.
    8. From the Run Macro dialog box, select Legacy Reflection Macro in Another File, Legacy RB Macro, or Legacy EXTRA! macro.
    9. Browse to the macro file that you want to run and click OK.

    Editing Legacy Reflection Macros

    You can edit legacy Reflection macros in the Visual Basic Editor. However, some Session methods and properties are no longer supported.

    If you are editing a legacy VBA macro, you can use the Visual Basic editor to modify the macro.

    If you are editing a Reflection Basic macro:

    Before you distribute any type of legacy macro, review the Unsupported Reflection Session Methods and Properties and remove any references to unsupported objects that throw exceptions.

    Note: For each legacy document, Reflection creates an additional VBA project for the supported legacy API. This legacy API VBA project includes a ThisSession object, which provides backward compatibility for legacy macros. (You can view the legacy API VBA project in the Project Explorer window of the Visual Basic Editor.)

    Editing Legacy EXTRA! Macros

    If you need to make changes to your legacy EXTRA! macros (.ebm), you can edit them using the EXTRA! Basic Editor.

    Then, edit the HostOptions properties in the macro to make the macro work with Reflection.

    Before you distribute any type of legacy macro, review the Unsupported EXTRA! Methods and Properties and remove any references to unsupported objects that throw exceptions.

    Edit HostOptions Properties

    If your macro uses the HostOptions object, you will need to edit the HostOptions properties.

    Legacy EXTRA! macros and Visual Basic applications that contain parameterized properties cause an error to occur in Reflection. When you run the macro or application, the HostOptions object returns the error "Method or property not found" if it encounters one of the following parameterized properties: AttributeForeground, AttributeBackground, or Color.

    Reflection is based on C# and doesn't support parameterized properties; therefore, statements that get and set these properties will have no effect. To avoid this problem, replace the parameterized properties with an equivalent form.

    To edit the property

    1. Start the EXTRA! Basic Editor.
    2. Open the macro.
    3. Replace the AttributeForeground, AttributeBackground, and Color properties using one of the following equivalent forms:
      • HostOptions.set_[property] x, y
      • y = HostOptions.get_[property]

      For example, change

      HostOptions.AttributeForeground(x) = y

      to

      HostOptions.set_AttributeForeground x, y

      -or-

      y = HostOptions.get_Attribute Foreground x

     

    See Also