I already have a successful "custom save" macro to save-as with a date stamp. I just want to have a message box ask to run it when someone tries to manually save. I essentially need "yes" to run the macro, "no" to save normally, and "cancel" to exit sub.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim answer As VbMsgBoxResult
answer = msgbox("Would you rather Save-As copy with date stamp?", vbYesNoCancel + vbQuestion + vbDefaultButton1, "You are overwriting the document!")
If answer = vbYes Then
Call filesave
ElseIf answer = vbNo Then
ActiveWorkbook.Save
Else
Exit Sub
End If
End Sub
Aucun commentaire:
Enregistrer un commentaire