Autosave on exit?

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
 
H

Harald Staff

Hi Alan

In the ThisWorkbook module:

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