开发者

Two methods of suppressing the save changes dialog in Excel are not working

Two methods of suppressing the save changes dialog in Excel are not working

Two methods of suppressing the save changes dialog in Excel are not working

Two methods of suppressing the save changes dialog in Excel are not working

For those who don't like images:

  Close logFile
  Application.DisplayAlerts = False 
  If WasOpened2 Then Workbooks(FilenameNoPath(FoundFiles(i))).Close False 
  Application.DisplayAlerts = True

Application.DisplayAlerts = False should suppress any and all开发者_Go百科 alerts from excel. Furthermore, I'm led to believe that passing False to .Close should automatically not save changes on the workbook. Yet I still get a prompt. Any ideas?


I had the inkling that another Excel add-in that was running alongside could be causing the issue. Coworker suggested to wrap with code to suppress events. This worked:

  Application.EnableEvents = False
  Application.DisplayAlerts = False
  If WasOpened2 Then Workbooks(FilenameNoPath(FoundFiles(i))).Close False 
  Application.DisplayAlerts = True
  Application.EnableEvents = True
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜