Private Sub myApp_WorkbookActivate(ByVal Wb As Workbook)
If Wb Is Me Then DisableSaveOptions
End Sub
Private Sub myApp_WorkbookDeactivate(ByVal Wb As Workbook)
If Wb Is Me Then EnableSaveOptions
End Sub
Private Sub Workbook_Open()
Set myApp = Application
DisableSaveOptions
End Sub
Private Sub DisableSaveOptions()
Dim ctls As Object
Dim ctl As Object
'disable the Save button
Set ctls = Application.CommandBars.FindControls(ID:=3)
For Each ctl In ctls
ctl.Enabled = False
Next
'disable the Save and Save As... options in the Menu
Set ctls = Application.CommandBars.FindControls(ID:=748)
For Each ctl In ctls
ctl.Enabled = False
Next
'disable the Save short-cut
Application.OnKey "^s", ""
End Sub
Private Sub EnableSaveOptions()
Dim ctls As Object
Dim ctl As Object
'enable the Save button
Set ctls = Application.CommandBars.FindControls(ID:=3)
For Each ctl In ctls
ctl.Enabled = True
Next
'enable the Save and Save As... options in the Menu
Set ctls = Application.CommandBars.FindControls(ID:=748)
For Each ctl In ctls
ctl.Enabled = True
Next
'enable the Save short-cut
Application.OnKey "^s"
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Saved = True
End Sub
Bookmarks