Try


Private Sub Workbook_BeforeClose(Cancel As Boolean)
    ThisWorkbook.Save    
End Sub