Disable Cut, Copy, Paste in Excel

This code will disable the function of copy, cut and paste in an Excel workbook, rendering the file very difficult to remove data from. There are other functions that can be restricted in Excel if you need even more complex protection from data theft such as rendering the right click button disabled or connecting hidden pages to a URL that needs authorising before the Excel sheet will display any information. Many different security options are discussed in our blogs, and we’d love to hear any ideas you may have on how to protect data in Excel.

Sub EnableMenuItem(ctlId As Integer, Enabled As Boolean)
'Activate/Deactivate specific menu item
Dim cBar As CommandBar
Dim cBarCtrl As CommandBarControl
For Each cBar In Application.CommandBars
If cBar.Name <> "Clipboard" Then
Set cBarCtrl = cBar.FindControl(ID:=ctlId, recursive:=True)
If Not cBarCtrl Is Nothing Then cBarCtrl.Enabled = Enabled
End If
Next
End Sub

Sub CutCopyPasteDisabled()
'Inform user that the functions have been disabled
MsgBox "Sorry! Cutting, copying and pasting have been disabled in this workbook!"
End Sub

Rendering the mouse right click is also a good measure to prevent data theft.

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
MsgBox ("Sorry Right Click is Disbaled for this Workbook")
End Sub

We would also recommend password protecting the VBA project as this is very difficult (not impossible) to break, which will make securing your Excel Worksheet more secure.

Please contact us for further information on how we secure our worksheets, using innovative ideas that don’t require add-ons or any advanced coding knowledge. Whilst it will never be 100% secure, the more difficult it becomes, the less likely it will be that the security will attempt to be compromised.