I was hoping somebody had a suggestion for how to solve this backup question.
I call the macro below from a Workbook_BeforeClose sub; however, if the user has not saved changes before they hit the close then the Sub SaveFile runs and then after the backup save they are then asked do you want to save changes.
I initially had this sub run with Workbook_BeforeSave, but I don't really want to run this everytime the user selects save.
Any ideas on how to how the save changes first and then the backup?
Sub SaveFile()
Dim Ans As Integer
Dim Filt As String
Ans = MsgBox("Confirm you want to save this File." _
& (Chr(13) & Chr(10)) & (Chr(13) & Chr(10)) & _
"File will save as: Backup - (SheetNumber).xls in current directory", vbYesNo)
If Ans = vbNo Then Exit Sub
Application.DisplayAlerts = False
ThisWorkbook.SaveCopyAs Filename:=ActiveWorkbook.Path & "\Backup - " & ThisWorkbook.Name
Application.DisplayAlerts = True
ThisWorkbook.Close
End Sub
Bookmarks