I am using microsoft excel to interact with attachmate extra.
The one thing I can not work out how to do is "sendstring". I have a variable that I want to send. Below is my code with the problem line of code, if you can help. The line of code thats wrong is sendstring "anm"
dim anm as string
Private Sub CommandButton1_Click()
anm = "authers name"
Call main
End Sub
Sub main()
'--------------------------------------------------------------------------------
' Get the main system object
Dim Sessions As Object
Dim System As Object
Dim objExcel As Object
Dim objWorkBook As Object
Dim objChart As Object
Set objExcel = GetObject(, "Excel.Application")
If objExcel Is Nothing Then
'If GetObject failed, open a new instance of Excel
Set objExcel = CreateObject("Excel.Application")
If objExcel Is Nothing Then
MsgBox ("Can not open Microsodt Excel.")
Exit Sub
End If
End If
' Make Excel visible on the screen
objExcel.Visible = True
Dim spreadSheet As Object
Set spreadSheet = ActiveWorkbook.ActiveSheet
Set System = CreateObject("EXTRA.System") ' Gets the system session
If (System Is Nothing) Then
MsgBox "Can not open Extra Session. Stopping ."
Stop
End If
Set Sessions = System.Sessions
If (Sessions Is Nothing) Then
MsgBox "Could not create the Session. Stopping ."
Stop
End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
g_HostSettleTime = 75 ' ms
OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
' Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
If (Sess0 Is Nothing) Then
MsgBox "Can not open Session. Stopping."
Stop
End If
If Not Sess0.Visible Then Sess0.Visible = True
getjobs:
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<HOME>mtcc<enter>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
sendstring "anm"
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<tab><tab><tab><tab><tab>")
end sub
The one thing I can not work out how to do is "sendstring". I have a variable that I want to send. Below is my code with the problem line of code, if you can help. The line of code thats wrong is sendstring "anm"
dim anm as string
Private Sub CommandButton1_Click()
anm = "authers name"
Call main
End Sub
Sub main()
'--------------------------------------------------------------------------------
' Get the main system object
Dim Sessions As Object
Dim System As Object
Dim objExcel As Object
Dim objWorkBook As Object
Dim objChart As Object
Set objExcel = GetObject(, "Excel.Application")
If objExcel Is Nothing Then
'If GetObject failed, open a new instance of Excel
Set objExcel = CreateObject("Excel.Application")
If objExcel Is Nothing Then
MsgBox ("Can not open Microsodt Excel.")
Exit Sub
End If
End If
' Make Excel visible on the screen
objExcel.Visible = True
Dim spreadSheet As Object
Set spreadSheet = ActiveWorkbook.ActiveSheet
Set System = CreateObject("EXTRA.System") ' Gets the system session
If (System Is Nothing) Then
MsgBox "Can not open Extra Session. Stopping ."
Stop
End If
Set Sessions = System.Sessions
If (Sessions Is Nothing) Then
MsgBox "Could not create the Session. Stopping ."
Stop
End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
g_HostSettleTime = 75 ' ms
OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
' Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
If (Sess0 Is Nothing) Then
MsgBox "Can not open Session. Stopping."
Stop
End If
If Not Sess0.Visible Then Sess0.Visible = True
getjobs:
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<HOME>mtcc<enter>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
sendstring "anm"
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
Sess0.Screen.SendKeys ("<tab><tab><tab><tab><tab>")
end sub