Here is the code:
1 Dim exExcel As Excel.Application
2 Dim exWorkbook As Excel.Workbook
3 Dim exSheet As Excel.Worksheet
5 exExcel = New Excel.Application
6 exWorkbook = exExcel.Workbooks.Open(strFilename)
7 exSheet = exWorkbook.Worksheets("Sheet1")
I get an error at line 6 saying:
---------------------------------------------------------------------------
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Program.exe
Additional information: The server threw an exception.
---------------------------------------------------------------------------
Now I know the file exists, and all dll's are loaded. Why am I coming up with this error?
Just in case, it might help to know that I am running under the NET framework, not vb6. I am using Excel 8.0 Object Library




Reply With Quote