PDA

View Full Version : Disable Save from Ctrl S



sujittalukde
02-08-2008, 03:28 AM
I am using the following code to disable the "Save" in File\Save. It disables the Save but Ctrl S is working.


Private Sub Workbook_Activate()
Dim oCtrl As Office.CommandBarControl
For Each oCtrl In Application.CommandBars.FindControls(ID:=3)
oCtrl.Enabled = False
Next oCtrl
End Sub

Ia ma enabling the same on Workbook Deactivate event. In the similar manner Save as is also disabled.

How can I also disable saving a workbook from Ctrl S?

Bob Phillips
02-08-2008, 04:16 AM
Just trap it directly



Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = True
End Sub