×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Can't run Excel VBA to Reflection 2008

Can't run Excel VBA to Reflection 2008

Can't run Excel VBA to Reflection 2008

(OP)
Hi All,

I'm new to this forum and to tweaking reflection, however I need to transfer some data from excel to reflection.
Need help on this code, it says that, g_hostsettletime and OldSystemTimeout& are not defined, tried to declare them as integer but then IbmScreen and IbmTerminal are not recognize. I got them from recording some items in Reflection and tweaking it a bit.

Thanks in advance.

CODE -->

Sub Submit()

    ' Get the main system object
    Dim Sessions As Object
    Dim System As Object
            Set System = CreateObject("EXTRA.System")    ' Gets the system object
    If (System Is Nothing) Then
        MsgBox "Could not create the EXTRA System object.  Stopping macro playback."
        Stop
    End If
        Set Sessions = System.Sessions
    If (Sessions Is Nothing) Then
        MsgBox "Could not create the Sessions collection object.  Stopping macro playback."
        Stop
    End If
    
    ' Set the default wait timeout value
    g_hostsettletime = 0.0000001        ' milliseconds
    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 "Could not create the Session object.  Stopping macro playback."
        Stop
    End If
    If Not Sess0.Visible Then Sess0.Visible = True
        Sess0.Screen.waithostquiet (g_hostsettletime)
    
    ' code proper
    Dim ibmCurrentScreen As IbmScreen
    Dim ibmCurrentTerminal As IbmTerminal
        Set ibmCurrentTerminal = ThisFrame.SelectedView.Control
        Set ibmCurrentScreen = ibmCurrentTerminal.Screen
    Dim oSS As Worksheet: Set oSS = ThisWorkbook.Sheets("Spreadsheet")
    Dim strPT As String: strPT = oSS.Range("B4").Value
    Dim intPT As Integer
    Dim intUp As Integer
    Dim intLow As Integer
        
    '\\MAINFRAME SCREEN
        oHeader = Sess0.Screen.getstring(1, 10, 3)
    If oHeader <> "123" Then
        MsgBox "Please go to TEST screen" & vbNewLine & "or Hit the Correct Macro Button", _
        vbCritical, "  Screen Error"
        Exit Sub
    Else
    End If
    
    Application.DisplayAlerts = False
    Application.ScreenUpdating = False
    
    
    Sess0.Screen.putstring obj.Sheets("Spreadsheet").Cells(5, "B").Value, 3, 10
    Sess0.Screen.waithostquiet (g_hostsettletime)
   
    Sess0.Screen.putstring obj.Sheets("TEST").Cells(6, "B").Value, 3, 54
    Sess0.Screen.waithostquiet (g_hostsettletime)
    
    Sess0.Screen.putstring obj.Sheets("TEST").Cells(7, "B").Value, 4, 11
    Sess0.Screen.waithostquiet (g_hostsettletime)
  
    Sess0.Screen.putstring obj.Sheets("TEST").Cells(8, "B").Value, 4, 30
    Sess0.Screen.waithostquiet (g_hostsettletime)
    
    'hit enter to populate info
    Call ibmCurrentScreen.SendControlKey(ControlKeyCode_Transmit)
    Sess0.Screen.waithostquiet (g_hostsettletime)
    
    
    '//FIND VARIABLE

    intUp = 1
    intLow = 2
    Do Until intUp > intLow
        If Trim(Sess0.Screen.getstring(intUp, X, Z)) = strPT Then
            intPT = Sess0.Screen.getstring(intUp, X - Y, Z)
            Sess0.Screen.waithostquiet (g_hostsettletime)
            oSS.Range("B9").Value = intPT
            Sess0.Screen.waithostquiet (g_hostsettletime)
            Exit Do
        ElseIf intUp < intLow Then
            intPT = intPT + 1
            Sess0.Screen.waithostquiet (g_hostsettletime)
        ElseIf intUp > intLow Then
            UserForm4.Show vbModal
        End If
    Loop
    
    intPT = oSS.Range("B9").Value
    Sess0.Screen.waithostquiet (g_hostsettletime)
    Sess0.Screen.putstring intPT, 18, 19
    Sess0.Screen.waithostquiet (g_hostsettletime)
    
    '//GO TO NEXT SCREEN
    Call ibmCurrentScreen.SendControlKey(ControlKeyCode_Transmit)
    Sess0.Screen.waithostquiet (g_hostsettletime)
    Call ibmCurrentScreen.SendControlKey(ControlKeyCode_Transmit)
    Sess0.Screen.waithostquiet (g_hostsettletime)
   
    
    Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(7, "L").Value, 7, 12
    Sess0.Screen.waithostquiet (g_hostsettletime)
    Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(7, "R").Value, 7, 18
    Sess0.Screen.waithostquiet (g_hostsettletime)
    Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(7, "X").Value, 7, 24
    Sess0.Screen.waithostquiet (g_hostsettletime)
    
    
    Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(7, "BX").Value, 7, 76
    Sess0.Screen.waithostquiet (g_hostsettletime)
    
    
    If Len(obj.Sheets("ENTRY").Cells(8, "J").Value) > 0 Then
        Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(8, "J").Value, 8, 10
    End If
    Sess0.Screen.waithostquiet (g_hostsettletime)
    
    
    Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(8, "AD").Value, 8, 30
    Sess0.Screen.waithostquiet (g_hostsettletime)
    
    intUp = 11
    intLow = obj.Sheets("Spreadsheet").Cells(3, "B").Value
    Do
        'CLM TYP
        Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(intUp, "").Value, intUp, 1
        Sess0.Screen.waithostquiet (g_hostsettletime)
        'SERV DATE
        Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(intUp, "").Value, intUp, 3
        Sess0.Screen.waithostquiet (g_hostsettletime)
        'BENEFIT ITEM
        Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(intUp, "").Value, intUp, 10
        Sess0.Screen.waithostquiet (g_hostsettletime)
        'CLM QTY
        Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(intUp, "").Value, intUp, 19
        Sess0.Screen.waithostquiet (g_hostsettletime)
        'OTHER FEE
        Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(intUp, "").Value, intUp, 24
        Sess0.Screen.waithostquiet (g_hostsettletime)
        'AMOUNT CLAIM
        Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(intUp, "").Value, intUp, 32
        Sess0.Screen.waithostquiet (g_hostsettletime)
        'AMT ALLOW
        Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(intUp, "").Value, intUp, 42
        Sess0.Screen.waithostquiet (g_hostsettletime)
        'REF #
        Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(intUp, "").Value, intUp, 52
        Sess0.Screen.waithostquiet (g_hostsettletime)
        'SPEC CD
        Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(intUp, "").Value, intUp, 60
        Sess0.Screen.waithostquiet (g_hostsettletime)
        Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(intUp, "").Value, intUp, 64
        Sess0.Screen.waithostquiet (g_hostsettletime)
        Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(intUp, "").Value, intUp, 68
        Sess0.Screen.waithostquiet (g_hostsettletime)
        Sess0.Screen.putstring obj.Sheets("ENTRY").Cells(intUp, "").Value, intUp, 72
        Sess0.Screen.waithostquiet (g_hostsettletime)
        intUp = instart + 1
    Loop Until intUp > intLow
    
    Call ibmCurrentScreen.SendControlKey(ControlKeyCode_Transmit)
    Sess0.Screen.waithostquiet (g_hostsettletime)
    Call ibmCurrentScreen.SendControlKey(ControlKeyCode_Transmit)
    Sess0.Screen.waithostquiet (g_hostsettletime)

End Sub 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close