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?
Thank you
Kind Regards,
Tommeck37
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