Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attachmate Reflections: Set View for an Open Session

Status
Not open for further replies.

BrainandStewie

Programmer
Jul 17, 2014
1
US
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?

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top