The other responders bring up some good points. You know your situation and
your users better than we do. Unless you have a malicious user who
intentionally wants to not save a changed file, perhaps a message box
telling him that the file has not been saved and asking him if he wants to
save it before closing, would be more appropriate. Your call. If yes, here
is the same macro with the message box. HTH Otto
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If ThisWorkbook.Saved = False Then
If MsgBox("This workbook has not been saved." & Chr(13) & _
"Do you want to save it before closing?", 20, "Workbook not
saved") = vbYes Then
ThisWorkbook.Save
ThisWorkbook.Saved = True
End If
End If
End Sub