Saving workbook

  • Thread starter Thread starter PG
  • Start date Start date
P

PG

Hi is there a way to make sure that someone would save
the workbook if there had been any changes whether they
like it or not!!

thanks
Peter Goddard
 
Use this workbook event macro. This saves the workbook if an attempt is
made to close it, whether the workbook has been changed or not. It doesn't
interfere with the Close command. It will still close. Also, it will save
the workbook even if it has been saved already. It acts on the Close
command.
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Save
ThisWorkbook.Saved = True
End Sub

With the file on the screen, right-click on the Excel icon to the left of
the word "File" in the menu across the top of the screen. Paste this macro
into the displayed module. HTH Otto
 

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