这个错误也搞了我好久,换了很多版本,后面在网上查到用xlWorkbookNormal来替代 xlExcel?,立马就可以了。

xlBook.SaveAs(FilePath,Microsoft.Office.Interop.Excel.XlFileFormat.xlExcel8, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

发现Office.Interop.Excel.XlFileFormat.xlExcel8格式与本机安装的office对不上,并且自己也不确定是当前office 版本,最好用Office.Interop.Excel.XlFileFormat.xlWorkbookNormal来替代,让程序自己去识别。

xlBook.SaveAs(FilePath, Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

相关文章:

  • 2021-12-21
  • 2021-11-21
  • 2021-09-05
  • 2022-03-13
  • 2021-08-10
  • 2021-10-08
  • 2022-02-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
  • 2021-06-09
  • 2021-12-09
相关资源
相似解决方案