Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't run Excel VBA to Reflection 2008

Status
Not open for further replies.

warhead92100

Technical User
Nov 3, 2014
8
CA
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top