Turn off warning messages

 2000-02-05    Application    0    59

Sometimes the application displays a messagebox asking if the user wants to continue, if he/she wants to save a file before closing, or want some other verification from the user. These messages can be turned off by using this command in a macro:

Application.DisplayAlerts = False
The warningmessages will remain turned off until you enable them again with this command:

Application.DisplayAlerts = True
If you just want to close a workbook without the user being prompted for any confirmations about saving the workbook you can simply do this:

ActiveWorkbook.Close False 
' closes the active workbook without saving any changes

ActiveWorkbook.Close True 
' closes the active workbook and saves any changes

Leave a comment:

Your comment will only be published after it has been moderated and found spam free.
Your e-mail address will only be used to display your Gravatar.