BrainandStewie
Programmer
I am working in MS Excel and I want to interact with an Attachmate Reflections session. The code below initates the sessions perfectly; however, how do you work in a session that is already opened? My issues arises at: Set View = Frame.CreateView(Terminal)
If the application is not running, this works perfectly; but how do you work with a session/terminal/application that is already active?
If the application is not running, this works perfectly; but how do you work with a session/terminal/application that is already active?
Code:
Public Sub DealWithReflections()
Dim App As Attachmate_Reflection_Objects_Framework.ApplicationObject
Dim Terminal As Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmTerminal
Dim Frame As Attachmate_Reflection_Objects.Frame
Dim View As Attachmate_Reflection_Objects.View
Dim MyScreen As Attachmate_Reflection_Objects_Emulation_IbmHosts.IbmScreen
' SavedSpace_PathWay is the pathway to the Attachmate Reflections .rd3x file
On Error Resume Next
Set App = GetObject(, "Attachmate_Reflection_Objects_Framework.ApplicationObject")
On Error GoTo 0
If (App Is Nothing) Then
Set App = CreateObject("Attachmate_Reflection_Objects_Framework.ApplicationObject")
If (App Is Nothing) Then
MsgBox "Unable to create object of Reflection system. The macro execution is interrupted."
Exit Sub
Else
Set Terminal = App.CreateControl(SavedSpace_PathWay)
End If
Else
Set Terminal = App.CreateControl(SavedSpace_PathWay)
End If
Set Frame = App.GetObject("Frame")
Frame.Visible = True
AppActivate Frame.Name
On Error Resume Next
Set View = Frame.CreateView(Terminal)
On Error GoTo 0
Set MyScreen = Terminal.screen
MyScreen.SendControlKeySync (ControlKeyCode_Home)
With MyScreen
[...]
End With
End Sub