Newbie Q: Opening Excel Workbook from c#???

ThienZ

Well-known member
Joined
Feb 10, 2005
Messages
45
Location
Germany
hi,

this might be a dumb question.... but i cant open a workbook from c#...
i have already insert the COM reference into the project, it was the MS Excel 11.0 Object Library, TypeLib-Version 1.5.
my code looks like this :
C#:
			object oMissing = Type.Missing;
			Excel.Application oApp = new Excel.ApplicationClass();
			Excel.Workbook oWB;
			Excel.Worksheet oWS;	

			oWB = oApp.Workbooks.Open(@"myxlfile.xls", 
				oMissing, oMissing, oMissing, oMissing, oMissing, oMissing,
				oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing);
it says : "Old Format or Invalid Type Library" on the Workbooks.Open part....

if i write Excel.Application oApp = new Excel. and press ctrl+space i could select _Application too, but it is an interface.... and there is no Application too...

Any suggestions to get it right? thx :)
 
i found the source of the problem. The Problem is that i have a german version of windows and english version of office. I read a microsofts site about this problem and it says if the local settings language and the office language arent the same, excel will try to locate a suitable MUI. if excel doesnt find it, it will throw this exception...
 
Back
Top