Configuring VBA Events for Host Screen Text in Reflection for IBM

  • 7021510
  • 25-Apr-2008
  • 23-Oct-2018


Reflection Desktop 16.0 and higher
Reflection 2014
Reflection for IBM 2014
Reflection for IBM 2011
Reflection Standard Suite 2011


This technical note explains how to configure Reflection Desktop 16, Reflection 2014, or Reflection 2011 to automatically run certain actions when specified text is displayed in the host terminal session. These actions are configured in a VBA (Visual Basic for Applications) event handler. This information may be of particular interest to former users of EXTRA! X-treme that used HotSpots configured to "auto-invoke" actions.


Background for Former Users of EXTRA! X-treme

In both EXTRA! X-treme and Reflection Desktop for IBM (or 2014 or 2011), you can configure HotSpots that enable you to click host text to send a terminal key function (for example, click "PF1" to send PF1). In EXTRA! X-treme, you could also configure actions to be automatically invoked when the HotSpot text is displayed in the host session. In Reflection Desktop for IBM, such automatic actions must be configured in a VBA event instead of HotSpots, as explained below.

Creating a VBA Event Handler to Perform an Action

In Reflection Desktop for IBM, events are exposed by the Reflection IbmScreen object. Follow these steps to create a VBA event handler with your desired code:

  1. Open a Reflection session.
  2. On the Ribbon, click the Tools tab and open the Visual Basic editor.
  3. In the Project panel on the left side of the editor, expand the Reflection Objects folder and double-click the ThisIbmScreen object. A code window opens.
  4. In the (General) drop-down list at the top of the code window, select the IbmScreen object.
  5. In the drop-down list to the right, which contains events associated with the selected object, click the NewScreenReady event. The following code is added to the code window automatically:
Private Sub IbmScreen_NewScreenReady(ByVal sender As Variant)

End sub

This NewScreenReady event-handler function will be invoked by Reflection every time a new host screen is displayed in the terminal.

  1. Code can now be added to this event macro to identify which screen has been reached, and take any action that might be required. For example,
If ThisIbmScreen.GetText(1, 66, 14) = "APPLID CICS23A" And _
   ThisIbmScreen.GetText(10, 11, 14) = "Userid . . . ." Then

   'a particular screen is something...
End If

Additional Information

For more information on VBA programming, see the product documentation at

The functionality of having an "action" run when a specific event occurs on a Host session screen has been added to Reflection Desktop 16.0 and later.  See Reflection Desktop 16.0 New Features and Release Notes at  

An Events Mapper utility has been added for Reflection events in 3270, 5250, and UNIX/OpenVMS (VT) sessions.  Using the Events Mapper, you can associate events with a Reflection action or command, Reflection macro, terminal keystroke, or any combination of these.  There are 17 events you can select with which to associate actions.  Each event can execute once per session, or every time the event occurs.  Events can also be defined so that they execute one after another, in the order shown in the Events list in the Events Mapper dialog box. Legacy-Reflection events can now be migrated to new Reflection Desktop session files and then updated and modified.  See for more information on how to use Reflection event mapping.

Legacy KB ID

This document was originally published as Attachmate Technical Note 2339.

Feedback service temporarily unavailable. For content questions or problems, please contact Support.