Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI i try to open excel workbook with this code
C#
Microsoft.Office.Interop.Excel.Application xlapp = new Microsoft.Office.Interop.Excel.Application();
xlapp.Visible = true;
Microsoft.Office.Interop.Excel.Workbookk xlworkbook = xlapp.Workbooks.Add(0);

and i add references from com tab but when i run this error was shown


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

 
Share this answer
 
Comments
Wendelius 20-May-12 6:48am    
Good links
Uday P.Singh 20-May-12 11:58am    
thanks Mika :)
Probably you have the same problem as described at: http://social.msdn.microsoft.com/Forums/en-CA/Vsexpressvb/thread/4565361b-aeff-4d01-af92-d21a6eb631e3[^]
i found the cause of the problem, it's because the user local settings are different from the office version, i use the english version and after setting language to english us, and country to united states in the reagional and language settings under control panel it worked fine
 
Share this answer
 
Comments
Wendelius 20-May-12 6:49am    
That could well be the cause
Maciej Los 20-May-12 7:04am    
Thank you, Mika ;)
VJ Reddy 20-May-12 9:34am    
Good reference. 5!
Maciej Los 20-May-12 9:53am    
Thank you, VJ ;)
Sounds to me like you may be trying to open excel with a version of Visual Studio that is old. May be that you have Visual Studio 2008 and Microsoft Office 2010. Try to download the Version 4 framework, and reference the 2010 interopt dll.

Note: it would help readability if you used the var insteaad of Microsoft.Office.Interop.Excel.Application.
 
Share this answer
 

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