All pastes #412755 Raw Edit

financecalc

public text v1 · immutable
#412755 ·published 2007-03-27 22:41 UTC
rendered paste body
'--------------------------------------------------------------------------------

 

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 = 10  ' time is in 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)

 

    

' This section of code contains the recorded events

 

    System.TimeoutValue = OldSystemTimeout

 

'Extra Object

  Dim Sys_Obj As Object, Sess_Obj As Object, SPOKScreen_Obj As Object

  Set SPOKScreen_Obj = Sess0.Screen

    

'Excel Object

  Dim Excel_Obj As Object, Excel_Sheet As Object

  Set Excel_Obj = GetObject(, "excel.application")

  Set Excel_Sheet = Excel_Obj.Workbooks("financetest.xls").Worksheets(1)

'Change ("xxxxxx.xls") part according to which ever worksheet your working from

 

 Dim Extra_Col As Integer

 Dim Extra_Row As Integer

 Dim Extra_Page As Integer

 Dim Excel_Row As Integer

 Dim Excel_Col As Integer

 Dim result As String

 

 LastExcelRow = Excel_Sheet.Cells(Cells.Rows.Count, 1).End(xlUp).Offset(1).Row

 For Excel_Row = InputBox("Input Starting Row") To LastExcelRow

   SPOKScreen_Obj.SendKeys ("")

   SPOKScreen_Obj.SendKeys ("")

   SPOKScreen_Obj.MoveTo 0, 0

   SPOKScreen_Obj.PutString Excel_Sheet.Cells(Excel_Row, 1).Value

   SPOKScreen_Obj.SendKeys ("")

   result = SPOKScreen_Obj.GetString()

   'You should be on Extra Screen for column one of start row of Excel.

   Excel_Sheet.Cells(Excel_Row, 2).Value = result

   SPOKScreen_Obj.WaitHostQuiet (g_HostSettleTime)

   

   result = SPOKScreen_Obj.GetString()

   'You should be on Extra Screen for column one of start row of Excel.

   Excel_Sheet.Cells(Excel_Row, 3).Value = result

 

   System.TimeoutValue = OldSystemTimeout

     

  Next Excel_Row

 

End Sub