Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel 2010 VBA - Close file No Save without prompt [duplicate]

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?

like image 363
Lugarini Avatar asked Jul 22 '14 16:07

Lugarini


People also ask

How do I turn on Save Changes prompt when I close a workbook in Excel?

Press Windows logo key and the R key to open the Run window. 2.In the Run box, type command: excel /safe and click OK. 3. When Excel is in safe mode, make some changes in the workbook, check if you will get the save prompt when closing the workbook.

How do I close a specific workbook in VBA?

Steps to Close a Workbook Specify the workbook that you want to close. Use the close method with that workbook. In the code method, specify if you want to save the file or not. In the end, mention the location path where you want to save the file before closing.


1 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
like image 105
mrbungle Avatar answered Oct 21 '22 20:10

mrbungle