Disable copy paste

The following code was previously posted to disable copy/paste.

It includes a message box to notify the user that right click has been disabled.

I would like to know how to add code to include a message box to notify the user that cut/copy has been disabled when the shortcut keys (control x/control c) are used.

Thank you in advance for any assistance!

Private Sub Workbook_Activate()
Application.CutCopyMode = False
Application.OnKey "^c", ""
Application.CellDragAndDrop = False
End Sub

Private Sub Workbook_Deactivate()
Application.CellDragAndDrop = True
Application.OnKey "^c"
Application.CutCopyMode = False
End Sub

Private Sub Workbook_WindowActivate(ByVal Wn As Window)
Application.CutCopyMode = False
Application.OnKey "^c", ""
Application.CellDragAndDrop = False
End Sub

Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
Application.CellDragAndDrop = True
Application.OnKey "^c"
Application.CutCopyMode = False
End Sub

Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
Cancel = True
MsgBox "Right click menu deactivated." & vbCrLf & _
"Cannot copy or ''drag & drop''.", 16, "For this workbook:"
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Application.CutCopyMode = False
End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Application.OnKey "^c", ""
Application.CellDragAndDrop = False
Application.CutCopyMode = False
End Sub

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Application.CutCopyMode = False
End Sub

Replies (1)

Please update how it's worked.

Thanks in advance

Rakesh

Leave a Reply

Your are not logged in . Please login to post replies

Click here to Login / Register  

Company
Featured 17 November 2026
Chartered Accountant

M/s. A V C & Co.

New Delhi

CA

View Details
Company
ARTICLESHIP 14 November 2026
Articleship Assistant

B Thejas and Associates

Bengaluru

CA Foundation

View Details
Company
19 November 2026
Accounts & Taxation Executive

MCSR and Associates LLP

Hyderabad

CA Inter

View Details
Company
Featured ARTICLESHIP 18 November 2026
Articles

Saini Pati Shah & Co LLP, Chartered Accountants

Mumbai

CA Foundation

View Details
Company
16 November 2026
Indirect Tax Associate

Sekhri Kanodia & Associates

Mumbai

B.Com

View Details
Company
Featured 29 October 2026
Accounts Executive

Synergy Keystone

Chennai

B.Com

View Details
Company
ARTICLESHIP 20 November 2026
Article clerk

Jain Sanjay Kumar & Co

Jaipur

CA Inter

View Details
Company
30 October 2026
Asst Manager Accounts

Goodwin Pumps India Pvt Ltd

Chengalpattu

CA Inter

View Details