Stop Excel Saving Via VBA

kingy

New Member
Joined
Sep 14, 2002
Messages
14
Im currently programming a excel workbook but when the code application.quit is used a confirmation box appears saying do you want to save blah blah, yes, no, cancel etc.

Is there a way of getting excel to close but not displaying this message box, i could use activeworkbook.save then application.quit but the problem is in this instance i dont want to save the workbook, any ideas ne one???
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

seacrest

Active Member
Joined
Aug 15, 2002
Messages
301
Try this
Sub auto_close()
ActiveWorkbook.Close SaveChanges:=False
End Sub
 

Forum statistics

Threads
1,144,148
Messages
5,722,773
Members
422,456
Latest member
lipa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top