How to find existing session name

Hi. I hope someone can please point me in the right direction.

I recently 'upgraded' from Attachmate to Micro Focus.

I am using Excel VBA with the Attachmate Extra! 9.0 Object Library.

Using VBA I want to check that there is an existing Session open with a specified name before continuing. This used to work with Attachmate, but now it stopped working with Micro Focus. It gives me this error on the last If statement in the below code: "The specified session is not available".

If I debug Extra_Sessions it only contains 'Item 1' with a Value of 'Nothing'

Hopefully someone can spot what I need to change please since upgrade to Micro Focus?

    Dim Extra_System As Object
    Dim Extra_Sessions As Object
    Dim i As Integer
    Dim Target_Session As Object
    Dim Extra_HostSettleTime As Long
    Dim Extra_OldSystemTimeout As Long
   
    On Error GoTo Err_GetTargetSession
        'Check that Extra is running
    Set Extra_System = CreateObject("EXTRA.System")   
    If (Extra_System Is Nothing) Then
        MsgBox "EXTRA! System objects could not be created. Macro playback is cancelled."
        GoTo Exit_GetTargetSession
    End If
   
    'Check that there is a 'Target' Session. Creates Target_Session
    Set Extra_Sessions = Extra_System.Sessions
    If (Extra_Sessions Is Nothing) Then
        MsgBox "Sessions collection object could not be created..", vbOKOnly
        GoTo Exit_GetTargetSession
    End If

For i = 1 To Extra_Sessions.Count

If InStr(UCase(Extra_Sessions.Item(i).name), "Target") <> 0 Then Set Target_Session = Extra_System.Sessions.Item(i)

Next

Parents
  • lee40,

    That looks like a reference to the old Extra! library.  You are referencing the Extra System object (late binding) in your code so try removing the reference to Attachmate Extra! 9.0 Object Library in VBA.  See if that changes the behavior.  If you find you need to reference the object for this to work you can reference the EXTRACOM object instead of the old Attachmate Extra! 9.0 Object in the tools references for the VBA project.

     

    Let me know if this changes the behavior

    Thanks,

    Jeff

Reply
  • lee40,

    That looks like a reference to the old Extra! library.  You are referencing the Extra System object (late binding) in your code so try removing the reference to Attachmate Extra! 9.0 Object Library in VBA.  See if that changes the behavior.  If you find you need to reference the object for this to work you can reference the EXTRACOM object instead of the old Attachmate Extra! 9.0 Object in the tools references for the VBA project.

     

    Let me know if this changes the behavior

    Thanks,

    Jeff

Children