使用Workbooks.Open读取excel文件时出错,SOS
。。。。。。
Excel.ApplicationClass app = new Excel.ApplicationClass();
Excel.WorkbookClass workBook = (Excel.WorkbookClass)app.Workbooks(Path,
Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value);
报如下错误:
An unhandled exception of type 'System.Runtime.InteropServices.COMException ' occurred in excel2txt.exe
Additional information: Old format or invalid type library.
请问是怎么回事啊,编译没错的阿
------解决方案--------------------加这个
_Application xlApp = null;
_Workbook xlWorkbook = null;
_Worksheet xlWorksheet = null;
System.Reflection.Missing oMissing = System.Reflection.Missing.Value;