Hello All,
I have sucessfuly disabled the save, save as, and other functions in the current workbook that I'm working on, but now these functions are disabled in any excel workbook I bring up. Is there a way to fix this? This is what my code currently looks like in "ThisWorkbook"
Thank you for the help
I have sucessfuly disabled the save, save as, and other functions in the current workbook that I'm working on, but now these functions are disabled in any excel workbook I bring up. Is there a way to fix this? This is what my code currently looks like in "ThisWorkbook"
Code:
Private Sub Worksheet_WindowActivate(ByVal Wn As Window)
Dim oCtrl As Office.CommandBarControl
'Cut
For Each oCtrl In Application.CommandBars.FindControls (ID:=21)
oCtrl.Enabled = False
'Copy
For Each oCtrl In Application.CommandBars.FindControls(ID:=19)
oCtrl.Enabled = False
'Save
For Each oCtrl In Application.CommandBars.FindControls(ID:=3)
oCtrl.Enabled = False
'Save As
For Each oCtrl In Application.CommandBars.FindControls(ID:=748)
oCtrl.Enabled = False
'Save as Web Page
For Each oCtrl In Application.CommandBars.FindControls(ID:=3823)
oCtrl.Enabled = False
'Save as Workspace
For Each oCtrl In Application.CommandBars.FindControls(ID:=846)
oCtrl.Enabled = False
'Move or Copy Sheet
For Each oCtrl In Application.CommandBars.FindControls(ID:=848)
oCtrl.Enabled = False
'Ctrl C
Application.OnKey "^c", ""
'Ctrl S
Application.OnKey "^s", ""
Application.CellDragAndDrop = False
End Sub
Private Sub Worksheet_WindowDeactivate(ByVal Wn As Window)
Dim oCtrl As Office.CommandBarControl
For Each oCtrl In Application.CommandBars.FindControls(ID:=21)
oCtrl.Enabled = True
For Each oCtrl In Application.CommandBars.FindControls(ID:=19)
oCtrl.Enabled = True
For Each oCtrl In Application.CommandBars.FindControls(ID:=3)
oCtrl.Enabled = True
For Each oCtrl In Application.CommandBars.FindControls(ID:=748)
oCtrl.Enabled = True
For Each oCtrl In Application.CommandBars.FindControls(ID:=3823)
oCtrl.Enabled = True
For Each oCtrl In Application.CommandBars.FindControls(ID:=846)
oCtrl.Enabled = True
For Each oCtrl In Application.CommandBars.FindControls(ID:=848)
oCtrl.Enabled = True
Application.OnKey "^c", ""
Application.OnKey "^s", ""
Application.CellDragAndDrop = True
End Sub
Thank you for the help