ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I set up a file to automatically save on exit? (https://www.excelbanter.com/excel-discussion-misc-queries/263844-how-do-i-set-up-file-automatically-save-exit.html)

Brian

How do I set up a file to automatically save on exit?
 
I have created a file that several users will be accessing with varying
computer skill level. I want to be sure that the file saves automatically
when they close the file out rather than having to answer "yes" to the "Do
you want to save this file?" question. Can this be done?

Otto Moehrbach[_2_]

How do I set up a file to automatically save on exit?
 
Brian
Yes, that can be done with VBA programming. The following macro will
save the file whenever a close command is issued by the user, regardless of
whether the file has already been saved. This is a Workbook event macro and
must be placed in the workbook module. Post back and provide your Excel
version if you need more help with this.. HTH Otto
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
ThisWorkbook.Save
ThisWorkbook.Saved = True
Application.DisplayAlerts = True
End Sub

"Brian" wrote in message
...
I have created a file that several users will be accessing with varying
computer skill level. I want to be sure that the file saves automatically
when they close the file out rather than having to answer "yes" to the "Do
you want to save this file?" question. Can this be done?




All times are GMT +1. The time now is 05:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com