Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Not SaveAsUI Then
Cancel = True
Application.EnableEvents = False
ActiveWorkbook.SaveAs Filename[B][COLOR=red]:[/COLOR][/B]=Format(Now, "dd-mm-yyyy hh-mm-ss")
Application.EnableEvents = True
End If
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If SaveAsUI Then
Cancel = True
Application.EnableEvents = False
ActiveWorkbook.SaveAs Filename:=Format(Now, "dd-mm-yyyy hh-mmss") & ".xlsm"
Application.EnableEvents = True
End If
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If ActiveWorkbook.Saved Then
Cancel = True
Exit Sub
End If
If SaveAsUI Or InStr(Me.Name, ".") = 0 Then
Cancel = True
Application.EnableEvents = False
ActiveWorkbook.SaveAs Filename:=Format(Now, "dd-mm-yyyy hh-mm-ss") & ".xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled
Application.EnableEvents = True
ActiveWorkbook.Saved = True
End If
End Sub