Getting this error mesage but not sure y. Can someone please help. Im trying to scrape multiple row payments from Attachmate and input it into column E but i keep getting this error message
Code:
Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$
Sub Main()
'--------------------------------------------------------------------------------
' 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 = 3000 ' 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 (0)
Dim fso As Object
Dim ts As Object
Dim i
Dim strCBName
Dim blnHasMoreLines
Set obj = GetObject("C:\Documents and Settings\Harjinder_Chahal\Desktop\Projects\Book1.xlsm") 'File is already open
'create the file system object
'Set fso = CreateObject("Scripting.FileSystemObject")
'get the copybook name
strCBName = "T328"
'create the copybook file
'Set ts = fso.CreateTextFile("C:\temp\" & strCBName & ".txt", True)
blnHasMoreLines = True
' record the loan information & column headers once
obj.Worksheets("Input").Cells(2, "A").Value = Sess0.Screen.GetString(4, 11, 1)
obj.Worksheets("Input").Cells(2, "B").Value = Sess0.Screen.GetString(4, 18, 6)
obj.Worksheets("Input").Cells(2, "C").Value = Sess0.Screen.GetString(4, 34, 11)
obj.Worksheets("Input").Cells(2, "D").Value = Sess0.Screen.GetString(5, 2, 27)
'copy all lines on the screen except the header until there are no more lines
While blnHasMoreLines
blnHasMoreLines = (Sess0.Screen.Search("NEXT PAYMENT DUE DATE").Value = "")
For i = 10 To 21
[COLOR="#FF0000"]obj.Worksheets("Input").Range("E2").Value = ts.Sess0.Screen.GetString(i, 10, 8)[/COLOR]
Next i
'send the next page command
Sess0.Screen.SendKeys ("<Pf8>")
Sess0.Screen.WaitHostQuiet (0)
Wend
'close and destroy objects
ts.Close
Set ts = Nothing
'Set fso = Nothing
MsgBox "Done recording " & strCBName
Sess0.Screen.WaitHostQuiet (0)
System.TimeoutValue = OldSystemTimeout
End Sub