BeforeSave, Cancel and ReadOnly
Ah it's ok I think I found a solution:
' In a module:
Public Sub ReplacementSave()
MsgBox "This is the replacement save subroutine"
End Sub
' In ThisWorkbook:
Private Sub Workbook_Activate()
For Each C In Application.CommandBars.FindControls(ID:=3)
C.OnAction = "ReplacementSave"
Next
Application.MacroOptions Macro:="ReplacementSave", HasShortCutKey:=True, ShortcutKey:="s"
End Sub
Private Sub Workbook_Deactivate()
For Each C In Application.CommandBars.FindControls(ID:=3)
C.OnAction = ""
Next
Application.MacroOptions Macro:="ReplacementSave", HasShortCutKey:=False
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
MsgBox "This message should not have appeared"
Cancel = True
End Sub
|