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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top