VBA workbooks.Close without being prompted to if the user wants to save?

后端 未结 2 1941
半阙折子戏
半阙折子戏 2020-11-30 13:58

I am writing a VBA program that converts .xls files into .csv files. The problem is that is brings up the \"Do you want to save the changes t

2条回答
  •  忘掉有多难
    2020-11-30 14:11

    Try using ThisWorkbook.Saved = True

            Application.DisplayAlerts = False
            currentBook.SaveAs Filename:=fileNameS, FileFormat:=xlCSV, ConflictResolution:=xlLocalSessionChanges
            currentBook.Saved = True            
            currentBook.Close SaveChanges:=False
            Application.DisplayAlerts = True
    

提交回复
热议问题