Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim fname As String, fdir As String, fnm As Range
Dim MyDate, MyMonth
Set fnm = Sheets(1).Range("A1")
fdir = "C:\Backup\"
MyDate = Date
MyMonth = Month(MyDate)
If ThisWorkbook.Saved = False Then
fname = fdir & MonthName(MyMonth) & "-" & Day(Date) & "-" & Year(Date) & "-" & fnm & ".xls"
Application.DisplayAlerts = 0
Application.DisplayAlerts = 1
Answers by Expert:
I can answer most excel questions My Website is davesexcel.com
I have been working with spreadsheets since 1991.
I am a self-trained excel developer since 2005.
My website davesexcel.com
Business admin. U of R.
Awards and Honors
Microsoft Excel MVP 2011-2012