C#: Open Excel (.XLSX) WorkBook => COMException

1

I try to open a .XLSX file from VS2010 .NET 3.5 on a 64bit Windows 7.

Thats the code:

string fileName = string.Format("{0}\\test.xlsx", Directory.GetCurrentDirectory());          

            Application _excelApp = new ApplicationClass();
            Workbook workBook = _excelApp.Workbooks.Open(fileName);

thats the error I get:

Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))

What do I wrong, I go nearly crazy... I tried everything I think at least...

c#
excel
interop
asked on Stack Overflow Dec 13, 2010 by Elisabeth • edited May 5, 2014 by tshepang

1 Answer

1

I can't comment on the code, but from working with excel on server-side in the past, you can get a lot of COM+ permissions errors that lead to this sort of error. Check your event logs and go from there.

answered on Stack Overflow Dec 13, 2010 by Craig

User contributions licensed under CC BY-SA 3.0