Home » excel » Excel 2010 VBA – Close file No Save without prompt

Excel 2010 VBA – Close file No Save without prompt

Posted by: admin March 9, 2020 Leave a comment

Questions:

I want to close a Excel 2010 file with VBA..
but when the code runs, it shows a prompt confirmation….
i dont want to see this prompt..

didnt work:

Application.DisplayAlerts = False

ActiveWorkbook.Close SaveChanges:=False

is there a way to do this?

How to&Answers:

If you’re not wanting to save changes set savechanges to false

    Sub CloseBook2()
        ActiveWorkbook.Close savechanges:=False
    End Sub

for more examples, http://support.microsoft.com/kb/213428 and i believe in the past I’ve just used

    ActiveWorkbook.Close False