Excel Vba Close Without Saving

[Solved] Excel Vba Close Without Saving | Vb - Code Explorer | yomemimo.com
Question : excel vba close without saving

Answered by : vastemonde

ActiveWorkbook.Close savechanges:=False

Source : | Last Update : Mon, 01 Mar 21

Question : excel vba prevent saving workbook

Answered by : vastemonde

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Cancel = True ' Cancels in any case ' Or : If SaveAsUI Then Cancel = True ' Cancels only if saving is asked by user, not via code
End Sub
' Prevents Excel from requesting a save before closing
Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.ThisWorkbook.Saved = True
End Sub

Source : | Last Update : Sun, 24 Jan 21

Answers related to excel vba close without saving

Code Explorer Popular Question For Vb