Help required with sendstring

smiler44

Registered User.
Local time
Today, 07:19
Joined
Jul 15, 2008
Messages
671
Help required with sendstring.......now resolved

I am using Excel to interact with something call Attachmate Extra.

I have just about all the code I need but an haing a problem with one piece, sendstring.

I may need a function or something to help or it could be as simple as changing the line of code but I dont know, can you help please?
The offending line is below in Blue text

Code:
   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)
       [COLOR=royalblue]sendstring "anm"[/COLOR]
    Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
    Sess0.Screen.SendKeys ("<tab><tab><tab><tab><tab>")
 
end sub



thankyou in advace
Smiler44
 
Last edited:
I solved it
the correct line of code to use is

Code:
Sess0.Screen.SendKeys anm

smiler44
 

Users who are viewing this thread

Back
Top Bottom