Could not create the session object. Stopping macro playback

Tommeck37

New Member
Joined
Nov 12, 2014
Messages
49
Hello,

I am struggling to automate certain process in mainframe Extra Attachmate.
I have the below code which is supposed to go to active session and enter specific references to the system in order to complete the task.

I have the code in Excel 2010. Attachmate open on the active session (after logging in)
When I execute the macro (by F5) excel reponds with MsgBox "Could not create the session..."

What is still missing to create the session? Can anyone help please?


Code:
Sub GetData()
Dim Sessions As Object
Dim System As Object
Dim Sess0 As Object
Dim Num0 As String
Dim Num1 As String
Dim Num2 As String
Num0 = Application.InputBox("Enter nostro number +13")
Num1 = Application.InputBox("Change what?")
Num2 = Application.InputBox("Change into")
Num3 = Application.InputBox("How Many")
'Extra Objects
Set System = CreateObject("EXTRA.System")
Set Sessions = System.Sessions
Set Sess0 = System.ActiveSession
If Sess0 Is Nothing Then
    MsgBox ("Could not create the Session object.  Stopping macro playback.")
    Exit Sub
End If
If Not Sess0.Visible Then Sess0.Visible = True
Sess0.Screen.WaitHostQuiet (3000)
'Now the active EXTRA! session is bound to the Object "Sess0", we can use it like a normal VBA object:

Sess0.Screen.MoveTo 1, 1

Sess0.Screen.SendKeys (Num0) 
Sess0.Screen.WaitHostQuiet (1000) 
Sess0.Screen.MoveTo 2, 1
Sess0.Screen.SendKeys (Num1) 
Sess0.Screen.WaitHostQuiet (1000) 
Sess0.Screen.SendKeys ("enter<ENTER><ENTER><ENTER>") 
Sess0.Screen.WaitHostQuiet (1000)
Sess0.Screen.MoveTo 1, 1
For i = 1 To Num3
Sess0.Screen.SendKeys (Num2)
 Sess0.Screen.WaitHostQuiet (1000)
Sess0.Screen.SendKeys ("enter<ENTER><ENTER><ENTER>") 
Sess0.Screen.WaitHostQuiet (1000)
Sess0.Screen.SendKeys ("y") 
Sess0.Screen.SendKeys ("enter<ENTER><ENTER><ENTER>")
Sess0.Screen.WaitHostQuiet (1000)
Next i
Sess0.Connected = False ' Disconnect from the mainframe session
'Tidying up
System.TimeoutValue = OldSystemTimeout
Set Sessions = Nothing
Set System = Nothing
Set Sess0 = Nothing
End Sub

Thank you
Kind Regards,
Tommeck37
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,223,275
Messages
6,171,122
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top