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
ARTICLESHIP 18 September 2026
Industrial Trainee

Twenty Point Nine Five Ventures Private Limited

Noida

CA Inter

View Details
Company
18 September 2026
Accounts & Finance Specialist

ULTRA CHEMICAL WORKS

Thane

CA Final

View Details
Company
ARTICLESHIP 15 September 2026
Freelance Taxation Content Writer Intern

Interactive Media Pvt Ltd.

New Delhi

CA Inter

View Details
Company
30 September 2026
Senior Accountant

Codeboard Technology

Chennai

B.Com

View Details
Company
ARTICLESHIP 07 October 2026
Article assistant

S.K.Bajpai & Co.

Noida

B.Com

View Details
Company
22 September 2026
Account Assistant

Chirag P Shah & Co. Chartered Accountant

Pune

B.Com

View Details
Company
Featured 12 September 2026
Assistant Manager - Finance & Compliance

Naveen Fintech Pvt Ltd

Kolkata

CA Inter

View Details
Company
Featured 21 September 2026
Consultant - Reporting

Finrep Advisors LLP

Mumbai

CA

View Details