Edit: here is the "ThisWorkbook" module, which is where you should add this code:
Original response: Add the following into the "ThisWorkbook" module:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim awb As Workbook
Dim BackupFileName As String
Dim i As Long
Dim OK As Boolean
Dim SameFileFormat As XlFileFormat
If TypeName(ActiveWorkbook) = "Nothing" Then Exit Sub
SameFileFormat = ThisWorkbook.FileFormat '<~ grab the file format
Set awb = ActiveWorkbook
If awb.Path = "" Then
Application.Dialogs(xlDialogSaveAs).Show
Else
BackupFileName = awb.FullName
i = 0
While InStr(i + 1, BackupFileName, ".") > 0
i = InStr(i + 1, BackupFileName, ".")
Wend
If i > 0 Then BackupFileName = Left(BackupFileName, i - 1)
BackupFileName = BackupFileName & "-bak" '<~ add "-bak" to the end of the filename
OK = False
On Error GoTo NotAbleToSave
With awb
Application.StatusBar = "Saving the workbook backup"
Application.DisplayAlerts = False
.SaveAs Filename:=BackupFileName, FileFormat:=SameFileFormat '<~ save occurs here
OK = True
Application.DisplayAlerts = True
Application.StatusBar = "Backup saved!"
Application.StatusBar = False
End With
End If
NotAbleToSave:
Set awb = Nothing
Application.StatusBar = False
If Not OK Then
MsgBox "Backup Copy Not Saved!", vbExclamation, ThisWorkbook.Name
End If
End Sub