المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Excel 2000 vs Excel 2007



C# Programming
09-09-2009, 06:12 PM
Hi Everyone, I am facing some kind of difficulty dealing with Microsoft Excel between version.
I am working on a program that open an excel file and write in it then close it.It works fine with excel 2007 version but giving me an exception with other version ( lower than 2007).

This is how I am creating the file.
Here my code:Microsoft.Office.Interop.Excel.Workbooks workbooks = xl.Workbooks;
Microsoft.Office.Interop.Excel.Workbook workbook = workbooks.Add(Microsoft.Office.Interop.Excel.XlWBATemplate.xlWBATWorksheet);
workbook.SaveAs(System.Environment.GetEnvironmentVariable("AppData") + "\\TestFile.xls",Microsoft.Office.Interop.Excel.XlFileFormat.xlExcel8,
Type.Missing,Type.Missing,Type.Missing,Type.Missing,Microsoft.Office.Interop.Excel.XlSaveAsAccessMod e.xlNoChange,Type.Missing,Type.Missing,
Type.Missing,Type.Missing,Type.Missing);

Thanks in Advance for your help

Jashim