Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am using Excel 2000 with C# in VS 2008. I added the excel 9.0 reference from COM tab under Reference. I am using VS 2008 and win forms. The code snippet is given below : Excel.Application appExcel = new Excel.Application(); appExcel.DisplayAlerts = false; Excel.Workbook wbkExcel = appExcel.Workbooks.Open("C:\\emp.xls", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); //<--Error here Excel.Worksheet wksExcel = (Excel.Worksheet)wbkExcel.Sheets[0]; wksExcel.Activate(); wbkExcel.Close(false, Type.Missing, Type.Missing); appExcel.Quit(); System.Runtime.InteropServices.Marshal.ReleaseComO bject(wksExcel); System.Runtime.InteropServices.Marshal.ReleaseComO bject(wbkExcel); System.Runtime.InteropServices.Marshal.ReleaseComO bject(appExcel); wksExcel = null; wbkExcel = null; appExcel = null; GC.Collect(); The error is : "Unable to cast COM object of type 'Microsoft.Office.Interop.Excel.ApplicationClass' to interface type 'Microsoft.Office.Interop.Excel._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208D5-0000-0000-C000-000000000046}' failed due to the following error: Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))." Any help is appreciated. Thanks. george |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
unable to cast ..Excel.ApplicationClass to ..Excel._Application | Excel Discussion (Misc queries) | |||
Unable to cast com object (interop) | Excel Discussion (Misc queries) | |||
Unable to open Excel 2000 | Excel Discussion (Misc queries) | |||
Object Required Error, Excel 2000 & 2003 | Excel Programming | |||
recipient unable to open excel 2003 doc with excel 2000 | New Users to Excel |