Seems like my first post went unnoticed... but still here is something which you are looking for... (Disabling Copy/Paste. Also disabling the shortcuts)
Code:'-- Disable Copy Paste Sub CopyPasteDisable() EnableControl 21, False EnableControl 19, False EnableControl 22, False EnableControl 755, False Application.OnKey "^c", "" Application.OnKey "^v", "" Application.OnKey "+{DEL}", "" Application.OnKey "+{INSERT}", "" Application.CellDragAndDrop = False End Sub 'Enable Copy Paste Sub CopyPasteEnable() EnableControl 21, True EnableControl 19, True EnableControl 22, True EnableControl 755, True Application.OnKey "^c" Application.OnKey "^v" Application.OnKey "+{DEL}" Application.OnKey "+{INSERT}" Application.CellDragAndDrop = True End Sub Sub EnableControl(ByVal lngCommandId As Long, _ ByVal blnEnabled As Boolean, Optional ByVal blnChangeCaption As Boolean) On Error Resume Next Dim ctlControls As CommandBarControls Dim ctlControl As CommandBarControl Dim strCaption As String ' Get all matching command controls. Set ctlControls = CommandBars.FindControls(ID:=lngCommandId) If Not ctlControls Is Nothing Then ' Get caption. strCaption = ctlControls.Item(1).Caption If blnChangeCaption = True Then If blnEnabled = True Then If Right$(strCaption, 9) = " Disabled" Then strCaption = Left$(strCaption, Len(strCaption) - 9) End If Else If Not Right$(strCaption, 9) = " Disabled" Then strCaption = strCaption & " Disabled" End If End If End If For Each ctlControl In ctlControls ctlControl.Enabled = blnEnabled ctlControl.Caption = strCaption Next End If End Sub




Reply With Quote