0
下面是將工作表複製到新的excel文件的代碼,但會拋出錯誤,如「您試圖打開的文件格式不同」我打開它。
這裏有什麼問題?Excel:您嘗試打開的文件格式不同
String startPath = System.IO.Path.GetDirectoryName(
System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
String filePath = System.IO.Path.Combine(startPath, strPath);
wBook = xCel.Workbooks.Open(filePath);
this.xCel.DisplayAlerts = false;
wSheet = (Excel.Worksheet)wBook.Worksheets.get_Item(2);
wSheet.Copy(Type.Missing, Type.Missing);
wSheet = (Excel.Worksheet)wBook.Sheets[2];
wSheet.SaveAs(strFileCopyPath);
請有人幫助我。
IC:是啊it' s「.xlsx」格式,我怎樣才能保存爲xls格式,這取決於我保存的原始文件。我該怎麼做。??還有一件事爲什麼我爲保存的一個獲得兩個相同的vbaproject? – user2144293 2013-03-11 10:40:25