BeforeSave, Cancel and ReadOnly
Users will be prompted to save changes if they try to close the workbook or
close Excel and Excel thinks changes have been made, so you might need to
add this to the ThisWorkbook module:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ReplacementSave
Saved = True
End Sub
--
Jim
"Steve Hunter" wrote in message
...
| 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
|
|