This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Updating Excel VBA Attachmate Extra macros to Reflection Desktop

Hello. I have developed numerous Excel VBA macros in Windows 10 that read and write data between an Excel workbook and a 3270 terminal opened with Attachmate Extra. I've been forced to upgrade to Reflection and now need to update all these macros.

With Attachmate Extra, setting up the interface within the macro was easy. I start with

FMS = GetObject("C:\Users\Public\Documents\Attachmate\EXTRA!\sessions\Session1.EDP")
Set FMSscreen = FMS.Screen
FMS.Visible = True

(I call the EXTRA System object "FMS", because that's the name of the mainframe system I'm using) 

Then, I could use methods like FMS.Screen.SendKeys or FMSscreen.GetString to write or read data from the terminal screen.

Looking at the Reflection Desktop documentation, it appears as though there are a lot more steps required to set this up. It looks like you need the following (after checking off the Reflection Libraries in References),

Set app = New Attachmate_Reflection_Objects_Framework.ApplicationObject
Set frame = app.GetObject("Frame")
Set terminal = app.CreateControl2("09E5A1B4-0BA6-4546-A27D-FE4762B7ACE1")
terminal.HostAddress = "demo:ibm3270.sim"
Set view = frame.CreateView(terminal)
frame.Visible = True
Set screen = terminal.screen

Now, you can use methods like screen.SendKeys or screen.PutText2 to write or read the data.

So, my questions:

  1. Is my summary above accurate?
  2. Would I replace "demo:ibm3270.sim" with "C:\Users\Public\Documents\Sessions\Session1.rd3x" (the location of my session file)
  3. The CreateControl2 method uses the API tab identifier, but that changes every time a new session is started (i.e. at least one a day in most situations). Is there a way to avoid forcing the user to look up the new API tab identifier every time they want to run the macro? That seems very awkward.

Thank you for any help!

Labels:

Reflection
  • Verified Answer

    +1

    Update! I also posted my question to my company's bulletin board, and got an even better answer than I could have imagined. All I need to do is replace

    FMS = GetObject("C:\Users\Public\Documents\Attachmate\EXTRA!\sessions\Session1.EDP")

    with

    Set exSys = CreateObject("extra.system")
    Set exSess = exSys.Sessions
    Set FMS = exSess(1)

    This has the added benefit of no longer needing to know the path to the session file, although  if you have more than one session open you may need to adjust the exSess parameter.

    Is this documented anywhere? I could not find it. Hopefully, this post will help others find the answer more easily.

  • 0   in reply to 

    Hi Johnathan Bernhardt,

    I am glad you were able to get the information you were looking for.  In addition to your internal information, I will add the online COM documentation to help you with the usage of the Objects and Properties you are calling.

    https://docs.attachmate.com/extra/x-treme/apis/com/

    Regards,

    Jeff B

  • 0 in reply to 

    One additional  note, If, like me, you are working through a transitional period where some users are using Reflection while others are still on Attachmate Extra, you'll be glad to know that the coding change above is backwards compatible -- It works with both systems.