Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have Open a excel file using C#.NET (COM application) and trying to get it's HInstance but it gives me error on 64 bit EXCEL 2010.

Here is my code

C#
objExelApp = new Excel.ApplicationClass();
objWorkbook = objExelApp.Workbooks.Add(misValue);
iHinstance = objExelApp.Hinstance; //This line gives error

objWorksheet = (Excel.Worksheet)(objWorkbook.Worksheets.get_Item(1));


Error : "Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))"

I have compile DLL with X64 but no luck.

Please help me to resolve the issue

Thanks in advance
Posted
Comments
Bernhard Hiller 21-Feb-13 2:51am    
Also Microsoft recommends the 32bit version of Excel - because of compatibility issues. See http://office.microsoft.com/en-001/excel-help/choose-the-32-bit-or-64-bit-version-of-office-HA010369476.aspx
Perhaps you need a different primary interop assembly generated from the 64 bit version. And adjust variable types etc....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900