Help!!!
I modified a macro that disabled copy and paste to disable the edit and tools menus.
Now it won't reactivate them... What am I doing wrong?
Option Explicit
Sub DisableCopyCutAndPaste()
EnableControl 30007, False 'tools
EnableControl 30003, False 'edit
Application.OnKey "^c", "Dummy"
Application.OnKey "^v", "Dummy"
Application.OnKey "+{DEL}", "Dummy"
Application.OnKey "+{INSERT}", "Dummy"
Application.CellDragAndDrop = False
Application.OnDoubleClick = "Dummy"
CommandBars("ToolBar List").Enabled = False
End Sub
Sub EnableCopyCutAndPaste()
EnableControl 30007, True 'tools
EnableControl 30003, True 'edit
Application.OnKey "^c"
Application.OnKey "^v"
Application.OnKey "+{DEL}"
Application.OnKey "+{INSERT}"
Application.CellDragAndDrop = True
Application.OnDoubleClick = ""
CommandBars("ToolBar List").Enabled = True
End Sub
Sub EnableControl(Id As Integer, Enabled As Boolean)
Dim CB As Control
Dim C As CommandBarControl
On Error Resume Next
For Each CB In Application.CommandBars
Set C = CB.FindControl(Id:=Id, recursive:=True)
If Not C Is Nothing Then C.Enabled = Enabled
Next
End Sub
Sub Dummy()
'// NoGo
MsgBox "Sorry, you cannot copy this read-only version of the planner!"
End Sub
Thanks