Autosave on Close

User avatar
Sundog
5StarLounger
Posts: 704
Joined: 28 Jan 2010, 22:47
Location: Alien Country (Roswell NM)

Autosave on Close

Post by Sundog »

Using Excel 2007, I have a file on a network server for trainees to sign up for classes. Sometimes a trainee will do all the necessary signup, then close Excel without saving; this loses all their changes. Is there a way to implement an Autosave on Close for this remote workbook?
Sundog

ABabeNChrist
SilverLounger
Posts: 1868
Joined: 25 Jan 2010, 14:00
Location: Conroe, Texas

Re: Autosave on Close

Post by ABabeNChrist »

Just a thought, have you tried

Code: Select all

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    ThisWorkbook.Save
End Sub

User avatar
HansV
Administrator
Posts: 78489
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Autosave on Close

Post by HansV »

In addition to ABabeNChrist's reply: the code he posted should go into the ThisWorkbook module of the workbook.
And it will work only if macros are enabled, of course.
Best wishes,
Hans