Autosave on exit?

  • Thread starter Thread starter Alan T
  • Start date Start date
A

Alan T

Is it possible to have a macro running automatically which will force
users of a spreadsheet to save their data before exiting? Or to have a
macro which automates the save process on exit?

The spreadsheet will be running on Excel 97 and 2000

Cheers
Alan
 
Hi Alan

In the ThisWorkbook module:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Save
Cancel = Not (ThisWorkbook.Saved)
End Sub
 
Back
Top