How to Save/Overwrite existing Excel file with Excel Interop - C#

后端 未结 3 1400
深忆病人
深忆病人 2020-12-30 01:46

Is there a way to save changes to an excel spreadsheet through the excel interop (in this case I am adding a worksheet to it) without having it prompt the user if they want

3条回答
  •  悲&欢浪女
    2020-12-30 02:03

    Basically, all you need is ExcelApp.DisplayAlerts = False - Here's how I do it, though:

    ExcelApp.DisplayAlerts = False
    ExcelWorkbook.Close(SaveChanges:=True, Filename:=CurDir & FileToSave)
    

    Hope this helps

提交回复
热议问题