L
Lucile
Hi all,
I am trying to open a Excel Workbook to check data in worksheets. The
ONLY info I have about the EXCEL file is its entire path. I tried to do
the following, but an exception occurs:
Dim _objXLApp As Excel.ApplicationClass
Dim _objXLFile As Excel.Workbook
Dim _objWorkSheets As Excel.Worksheets
Dim _objXLSheet As Excel.Worksheet
Dim _objRange As Excel.Range
Dim _strPath As String
_strPath = "C:\LOCALDATA\FCP_93.xls"
_objXLApp = New Excel.ApplicationClass
_objXLApp.Visible = False
Try
_objXLFile = _objXLApp.Workbooks(_strPath) 'EXCEPTION HERE:
"Invalid Index"
_objWorkSheets = _objXLFile.Worksheets()
' code continues here
Catch ex As Exception
Show(ex.Message)
End Try
Any idea?
Thanks.
L.
I am trying to open a Excel Workbook to check data in worksheets. The
ONLY info I have about the EXCEL file is its entire path. I tried to do
the following, but an exception occurs:
Dim _objXLApp As Excel.ApplicationClass
Dim _objXLFile As Excel.Workbook
Dim _objWorkSheets As Excel.Worksheets
Dim _objXLSheet As Excel.Worksheet
Dim _objRange As Excel.Range
Dim _strPath As String
_strPath = "C:\LOCALDATA\FCP_93.xls"
_objXLApp = New Excel.ApplicationClass
_objXLApp.Visible = False
Try
_objXLFile = _objXLApp.Workbooks(_strPath) 'EXCEPTION HERE:
"Invalid Index"
_objWorkSheets = _objXLFile.Worksheets()
' code continues here
Catch ex As Exception
Show(ex.Message)
End Try
Any idea?
Thanks.
L.