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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reflection 2008 code won't run on Extra

Status
Not open for further replies.

warhead92100

Technical User
Nov 3, 2014
8
CA
Hi All,

Another question, I have this code working in Reflection 2008 but not in Extra Enterprise. I am running them through the vb editor built in and not as external files (.vb, .edm, etc) as I am not sure how to do that.
Any idea on the codes below is greatly appreciated.

Thanks in advance.

Code:
Sub AddChg()

'Declare Variables
    Dim Sessions As Object
    Dim System As Object
    Dim Sess0 As Object
    Dim obj As Object
    Dim objWorkbook As Object
    Dim oHeader As String
    Dim oIdentifier As String
    Dim Screen1 As Integer
    Dim Screen2 As Integer
    'Dim ibmCurrentScreen As IbmScreen
    'Dim ibmCurrentTerminal As IbmTerminal
	'Set ibmCurrentTerminal = ThisFrame.SelectedView.control
	'Set ibmCurrentScreen = ibmCurrentTerminal.Screen

'Get the main system 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
    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
    Set obj = GetObject(, "Excel.Application")
    
    oIdentifier = obj.Sheets("Spreadsheet").Cells(1, "A").Value
    If oIdentifier <> "MEGAPROJECT" Then
        MsgBox "Please open correct spreadsheet file", vbCritical, "  Screen Error"
        Exit Sub
    Else
    End If

    oHeader = Sess0.Screen.GetString(1, 35, 11)
    If oHeader <> "CHANGE MENU" Then
        MsgBox "Please go to CHANGE MENU screen" & vbNewLine & "or Hit the Correct Macro Button", _
        vbCritical, "  Screen Error"
        Exit Sub
    Else
    With objWorkbook
        If Len(obj.Sheets("Spreadsheet").Cells(4, "C")) > 0 Then
            Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(4, "C").Value, 5, 31    
        Else
            Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(33, "C").Value, 5, 31    
        End If
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
    End With
    End If

    

    Screen1 = obj.Sheets("Spreadsheet").Cells(3, "A").Value
    If Screen1 > 0 Then
        Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(2, "A").Value, 12, 7    
        Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
        Sess0.Screen.Sendkeys("<Enter>")              			   ' HIT ENTER
        Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY

On Error Resume Next

        With objWorkbook

            If Len(obj.Sheets("Spreadsheet").Cells(5, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(5, "C").Value, 7, 16    ' 
                Sess0.Screen.waithostquiet (g_hostsettletime)                              '        --WAIT SERVER TO BE READY
            End If

            If Len(obj.Sheets("Spreadsheet").Cells(6, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(6, "C").Value, 8, 16   
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If

            If Len(obj.Sheets("Spreadsheet").Cells(7, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(7, "C").Value, 8, 52   
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(8, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(8, "C").Value, 8, 78 
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(9, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(9, "C").Value, 9, 16 
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(10, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(10, "C").Value, 10, 74 
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(12, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(12, "C").Value, 11, 12  
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(15, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(15, "C").Value, 14, 12  
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(16, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(16, "C").Value, 14, 52  
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(17, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(17, "C").Value, 14, 69 
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(19, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(19, "C").Value, 16, 12  
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(22, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(22, "C").Value, 19, 12 
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(23, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(23, "C").Value, 19, 52  
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(24, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(24, "C").Value, 19, 69  
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(25, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(25, "C").Value, 20, 17  
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(26, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(26, "C").Value, 20, 31  
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(27, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(27, "C").Value, 20, 51  
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(28, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(28, "C").Value, 20, 73  
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
            Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(2, "A").Value, 24, 7         
            Sess0.Screen.waithostquiet (g_hostsettletime)                       '       --WAIT SERVER TO BE READY
            Sess0.Screen.Sendkeys("<Enter>")			                   ' HIT ENTER
            Sess0.Screen.waithostquiet (g_hostsettletime)                           '       --WAIT SERVER TO BE READY
    	    Sess0.Screen.sendkeys("<F3>")
            Sess0.Screen.waithostquiet (g_hostsettletime)                           '       --WAIT SERVER TO BE READY
        End With
    End If

    Screen2 = obj.Sheets("Spreadsheet").Cells(4, "A").Value
    If Screen2 > 0 Then
        Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(2, "A").Value, 12, 7    
        Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
        Sess0.Screen.Sendkeys("<Enter>")			              ' HIT ENTER
        Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY

        With objWorkbook
                   
            If Len(obj.Sheets("Spreadsheet").Cells(39, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(39, "C").Value, 11, 18  
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(40, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(40, "C").Value, 11, 42  
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(41, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(41, "C").Value, 11, 65 
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(42, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(42, "C").Value, 12, 31 
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
    
            If Len(obj.Sheets("Spreadsheet").Cells(43, "C")) > 0 Then
                Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(43, "C").Value, 15, 4   
                Sess0.Screen.waithostquiet (g_hostsettletime)                      '        --WAIT SERVER TO BE READY
            End If
        Sess0.Screen.putString obj.Sheets("Spreadsheet").Cells(2, "A").Value, 24, 7         ' SAVE DATA
        Sess0.Screen.waithostquiet (g_hostsettletime)                       '       --WAIT SERVER TO BE READY
        Sess0.Screen.Sendkeys("<Enter>")		                   ' HIT ENTER
        Sess0.Screen.waithostquiet (g_hostsettletime)                           '       --WAIT SERVER TO BE READY
    	Sess0.Screen.sendkeys("<F3>")
        Sess0.Screen.waithostquiet (g_hostsettletime)                           '       --WAIT SERVER TO BE READY

        End With
    End If

On Error GoTo 0
'===============================================================================================================================

System.TimeoutValue = OldSystemTimeout
Set objXL = Nothing

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top