There are a number of ways to execute macros:
Setting up Keyboard Maps or Buttons for Macros
Running Macros When Certain Events Occur
Running Macros When Certain Screens Are Recognized
Running Reflection Macros from Excel or Another Application
Running a Macro in Another Session Document
Running a Macro in the Common Project
You can set up macros to run from keyboard shortcuts or from buttons on the interface.
You can add a keyboard shortcut that runs a macro by modifying the keyboard map for your session. You can do this in two ways:
You can add buttons to the Reflection Ribbon that run macros (see "Add a Button to Run a Macro" in the Reflection Help.)
You can also display the button or make it active only on certain screens or for certain users (see Dynamically Change the User Interface.)
You can trigger macros with events. Key Reflection events occur when:
This sample runs a macro before the session closes.
You can automatically run macros when certain screens are displayed.
You can run Reflection macros from Excel.
This Excel macro runs the TurnOnScratchPad macro in a Reflection session. The session must be open and have focus in the Reflection workspace
To access a macro in another session document VBA project, you can reference that project in the Visual Basic Editor. The advantage of a reference is that you can maintain a single copy of your macros in a centrally located project. If you make changes to a macro, all projects that reference it get the updated version. Changes you make to your referenced project have no effect on session documents that reference your project or to the macros they contain.
To reference a project, follow the same process you use to add an object library reference.
You can create macros in the Reflection Common project and then run them from any session.
Macro in the Common project |
Copy Code
|
---|---|
Sub ChangeTitleOfSelectedView() 'Get the selected view and change its title ThisFrame.SelectedView.titleText = "Selected" End Sub |
Macro that calls a macro in the Common project |
Copy Code
|
---|---|
Sub CallCommonMacro() Call ViewMacro.ChangeTitleOfSelectedView End Sub |