moorthy subramani

moorthy subramani

  • NA
  • 19
  • 79.4k

Unable to cast COM object of type 'Microsoft.Office.Interop.

Mar 13 2013 3:17 AM
Hi,
I am getting this error while i export and import the excel file in the office 2003 format.
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)).
this is the code i wrote,

Microsoft.Office.Interop.Excel.Application objApplication = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel._Workbook workbook = objApplication.Workbooks.Add(Type.Missing);
Microsoft.Office.Interop.Excel.Sheets xlSheets = workbook.Worksheets;
Microsoft.Office.Interop.Excel._Worksheet worksheet = null;

Please any one help me for this problem...

Answers (10)