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:
- Is my summary above accurate?
- Would I replace "demo:ibm3270.sim" with "C:\Users\Public\Documents\Sessions\Session1.rd3x" (the location of my session file)
- 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!