» Turn off warning messages using VBA in Microsoft Excel
VBA macro tip contributed by
Erlandsen
Data Consulting offering Microsoft Excel Application development,
template customization, support and training solutions
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
Terms
and Conditions of use
The applications/code on this site are distributed as is and without warranties
or liability. In no event shall the owner of the copyrights, or the authors
of the applications/code be liable for any loss of profit, any problems
or any damage resulting from the use or evaluation of the applications/code.