Excel SaveFile YesNoCanel box

In VBA how do I force answer Yes each time I want to save a file.  I have a file that I save to multiple locations and I want it to not need that question answered each time.  Can this be done?  -R-
Who is Participating?
Glenn RayExcel VBA DeveloperCommented:
In VBA, add the following line of code early in the macro:

Application.DisplayAlerts = False

This will disable overwrite messages such as above.

You also need turn this back on before exit.
Application.DisplayAlerts = True
Have a look at his: http://www.vbforums.com/showthread.php?t=528826

Hope that helps.
RWayneHAuthor Commented:
Thanks!!  Will this work when deleting sheet tabs too?  -R-
Glenn RayExcel VBA DeveloperCommented:
RE: Deleting sheet tabs...yes, it will.

That's why you have to be careful with this function.  If it remains FALSE, you can bypass messages during your Excel session that might prevent accidental overwriting/deletion.
RWayneHAuthor Commented:
Thanks for the help. -R-
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.