Closing an Excel Spreadsheet via command button

B

bartlwf

Currently running Excel 2003
I have an excel program that I created for my wife's business that I
want to exit via an "exit button" without having any more user
interface. I can't seem to get past the standard excel message "Do
you want to save this file? ........Yes....No.......Cancel"
I just want to exit, no questions asked leaving the program intact.
Any Ideas?

Also, does anyone know of a website or place I can go to view excel
programs that demonstrate vba programs using the different uses of
UserForms and command buttons?

Thanks for any help you can shed on this.
 
M

Mike

This will work without saving workbook
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True

This will work with saving workbook
Application.DisplayAlerts = False
ActiveWorkbook.save
ActiveWorkbook.Close
Application.DisplayAlerts = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top