Hi,
I am writing a script in VBA to pull some values from an Excel spread sheet to update a Unix program using Attachemate Reflection. I am getting the error above on the file path line. I can't see anything wrong with it. Did anyone get this error before and was able to fix it?
Thanks.
Code:
Sub GetDataFromExcel()
'get data from an .xls worksheet...
'for reference documention on how to use Excel programmatically like
'this,
'open Excel, then open the Excel VBA Editor and select "Microsoft
'Visual Basic Reference"
Dim xl As New Excel.Application
Dim r As Integer
Dim c As Integer
Dim DataValue As String
Dim xlFile As Excel.Workbook
Set xlFile = xl.Workbooks.Open("C:\test.xls")
CR = Chr(Reflection2.ControlCodes.rcCR)
ESC = Chr(Reflection2.ControlCodes.rcESC)
With Session
For r = 1 To 3
For c = 1 To 3
DataValue = xlFile.Worksheets("Sheet1").Cells(r, c).Value
'send the data retrieved from Excel to the Reflection session
Session.Transmit DataValue & Chr(13)
Next
'Press VtF10 (Perform the Vt F10 function).
.TransmitTerminalKey rcVtF10Key
Next
End With
xl.Quit 'close excel when done
ErrorHandler:
Session.MsgBox Err.Description, vbExclamation + vbOKOnly
' Recording stopped at 14:19:54.69.
End Sub
Mo
I am writing a script in VBA to pull some values from an Excel spread sheet to update a Unix program using Attachemate Reflection. I am getting the error above on the file path line. I can't see anything wrong with it. Did anyone get this error before and was able to fix it?
Thanks.
Code:
Sub GetDataFromExcel()
'get data from an .xls worksheet...
'for reference documention on how to use Excel programmatically like
'this,
'open Excel, then open the Excel VBA Editor and select "Microsoft
'Visual Basic Reference"
Dim xl As New Excel.Application
Dim r As Integer
Dim c As Integer
Dim DataValue As String
Dim xlFile As Excel.Workbook
Set xlFile = xl.Workbooks.Open("C:\test.xls")
CR = Chr(Reflection2.ControlCodes.rcCR)
ESC = Chr(Reflection2.ControlCodes.rcESC)
With Session
For r = 1 To 3
For c = 1 To 3
DataValue = xlFile.Worksheets("Sheet1").Cells(r, c).Value
'send the data retrieved from Excel to the Reflection session
Session.Transmit DataValue & Chr(13)
Next
'Press VtF10 (Perform the Vt F10 function).
.TransmitTerminalKey rcVtF10Key
Next
End With
xl.Quit 'close excel when done
ErrorHandler:
Session.MsgBox Err.Description, vbExclamation + vbOKOnly
' Recording stopped at 14:19:54.69.
End Sub
Mo