tags:

views:

434

answers:

5

Hi,

I'm trying to open an excelworkbook and trying to get an worksheet in it. Excelapp.workbooks.Open line is throwing an Exception as System.Runtime.InteropServices.COMException from HRESULT: 0x800A03EC at Microsoft.Office.Interop.Excel.Workbooks.Open

Here is my code Excel.Application excelApp = new Excel.ApplicationClass(); Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(strWBPath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,Type.Missing, Type.Missing, Type.Missing, true);

StrWbPath is my Excel location. I'm refering to 2007 excel and added Microsoft.office.interop.excel of version 12.0.0.0.

Any pointers are greatly appreciated

Thanks.

A: 

What if you try System.Reflection.Missing.Value instead of Type.Missing?

Regards,

M.

Michel van Engelen
+1  A: 

Someone here: http://bitterolives.blogspot.com/2009/03/excel-interop-comexception-hresult.html had similar problem.

empi
A: 

Which class are you using?

Microsoft.Office.Interop.Excel.ApplicationClass

if this then try changing it to

Microsoft.Office.Interop.Excel.Application
Pragnesh Patel
A: 

i have tried the option suggested by Michel van engleen. Still it gives me the same error.

Amrita
A: 

I'm using Microsoft.Office.Interop.Excel.Application class

Amrita