Skip to content

Recording and Deleting VBA Macros

You can record a VBA macro to automate your interaction with host applications, including:

  • Sending data to, or typing text in, a host application.

  • Cutting, copying, or pasting text or data from one host application to another.

  • Switching tabs to move from one host application to another.

  • Selecting text with a mouse or clicking the mouse to move the cursor (mouse clicks are recorded as cursor positions.)

You cannot record:

  • Interaction with Reflection settings and Productivity features (such as Spell Check, Auto Expand, and Auto Complete).

  • Connecting to or disconnecting from a host.

  • Interaction with Web applications.

  • Cutting or pasting from a host to an external application (for example, Notepad).

Best Practices for Recording Macros

Use the following best practices to carefully record your macro will help prevent problems that can occasionally occur when using a slower network connection. Typing very fast while recording or "typing ahead" in a session, while connected with a slow network connection can cause your macro to play back in unexpected ways. Following these best practices will lead to the best results.

  • Plan in advance of the recording to make sure you know the steps you will follow, which keys you will press, and which host screens are anticipated.

  • While recording the macro, after pressing a key to submit data to the host, wait for the next host screen to fully appear (sometimes even waiting a few extra seconds) before pressing the next keys.

  • If your macro doesn't play back like you expect, delete the macro and carefully record it again using slow and deliberate steps.

Recording a macro slowly and carefully does not cause the macro to run with reduced performance, as macros always run at the fastest speed possible during playback. Recording a well thought out and planned macro will lead to the best results.

To record a macro

  1. Start macro recording. The steps depend on your user interface mode.

    User Interface Mode Steps
    Ribbon On the Macros tab, from the Advanced group, click Record VBA.
    Reflection Browser On the Reflection menu, choose Tools, Macro and then Record VBA Macro.
    TouchUx Tap the Wrench icon, and then under Macro, select Record VBA Macro.
  2. Perform the task(s) that you want to automate.

  3. (Optional) If you need to interrupt the recording to perform another task, click Pause Recording. When you are ready to resume recording, click Pause Recording again.

  4. When you are finished recording the macro, click Stop Recording.

    The Recording Complete dialog box appears.

  5. Name the macro and choose the location where you want to save it.

  6. If you want to run the macro every time the session connects, select Make this the Connect Macro.

    note

    You can fine-tune recorded macros by using the Visual Basic Editor. For more information, see Edit a Macro.

  7. If your macro doesn't play back like you expect, delete the macro and follow best practices to carefully record the macro again.

To delete a macro

  1. Open the Run Macro dialog box. The steps depend on your user interface mode.

    User Interface Mode Steps
    Ribbon On the Session tab, from the Macros group, click Run Macro.
    Classic and Classic MDI On the Macro menu, choose Macros.
  2. Select Reflection Workspace Macro.

  3. In the Macros dialog box, select the macro you want to remove and then click Delete.

Videos

Record a Macro Record a Macro in Classic Mode