Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim combiName As String, curYear As String, curMonth As String, curDay As String, curHour As String, curMinute As String, curName As String, ext As String, sNewName As String, fPth As Object
Set fPth = Application.FileDialog(msoFileDialogSaveAs)
curYear = Year(Date)
curMonth = Month(Date)
If curMonth < 10 Then
curMonth = "0" & curMonth
End If
curDay = Day(Date)
If curDay < 10 Then
curDay = "0" & curDay
End If
curHour = Hour(Time())
If curHour < 10 Then
curHour = "0" & curHour
End If
curMinute = Minute(Time())
If curMinute < 10 Then
curMinute = "0" & curMinute
End If
sep = "."
curName = "current_filename"
ext = ".xlsm"
Cancel = True
combiName = curName & sep & curMonth & sep & curDay & sep & curYear & ext
msg = "Please name file in accordance with company policy."
MsgBox msg
With fPth
.InitialFileName = combiName
.Title = "Save your File:"
.InitialView = msoFileDialogViewList
.Show
End With
End Sub