How do I disable the right mouse cut and paste facility?

DexonII

New Member
Joined
Sep 8, 2005
Messages
34
I need to be able to prevent any user from cutting and pasting data in one of my spreadsheets. I have protected it all, removed cut and paste from the options- edit tab, but you can still cut and paste with the right mouse shortcut key.

How do I stop this from being available?

Paul.
 
I can't reproduce the error, sorry. Try running the code and when you get the error click the Debug button and see which line of code is highlighted. Then post all of the cut/paste disabling code here and indicate the faulting line.
 
Upvote 0

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Hi VoG,

Here is the code as I am using it. It needs to be debugged as shown:

Sub Disable_cut_copy_paste()

Application.OnKey "^{c}", "" 'Copy
Application.OnKey "^{v}", "" 'Paste
Application.OnKey "^{x}", "" 'Cut

ShortcutMenus(xlWorksheetCell).MenuItems("Cut").Delete 'needs debugging on this line

ShortcutMenus(xlWorksheetCell).MenuItems("Copy").Delete
ShortcutMenus(xlWorksheetCell).MenuItems("Paste").Delete
ShortcutMenus(xlWorksheetCell).MenuItems("PasteSpecial").Delete
End Sub

This sub is called when the workbook is opened.

Any ideas?
 
Upvote 0
Try this

Code:
Sub Disable_cut_copy_paste()

Application.OnKey "^{c}", "" 'Copy
Application.OnKey "^{v}", "" 'Paste
Application.OnKey "^{x}", "" 'Cut

On Error Resume Next
ShortcutMenus(xlWorksheetCell).MenuItems("Cut").Delete
ShortcutMenus(xlWorksheetCell).MenuItems("Copy").Delete
ShortcutMenus(xlWorksheetCell).MenuItems("Paste").Delete
ShortcutMenus(xlWorksheetCell).MenuItems("PasteSpecial").Delete
On Error GoTo 0
End Sub
 
Upvote 0
That sort of works - the cut copy and paste have all disappeared, but the paste special option is now available and it pastes the last copy I performed.

For exemple the last thing I copied was a sub routine to display a message box and the code for this is pasted special when I use the right mouse option.

How do i solve this? Is there some way to "clear" the paste special memory?
 
Upvote 0
That doesn't appear to do it.

I can now paste Application.CutCopyMode = False everywhere cos it was the last thing i copied.

Am I not specifying the paste special correctly to disable the shortcut menu item?
 
Upvote 0
This works for me:

Code:
Sub Disable_cut_copy_paste()
Application.CutCopyMode = False
Application.OnKey "^{c}", "" 'Copy
Application.OnKey "^{v}", "" 'Paste
Application.OnKey "^{x}", "" 'Cut
On Error Resume Next
ShortcutMenus(xlWorksheetCell).MenuItems("Cut").Delete
ShortcutMenus(xlWorksheetCell).MenuItems("Copy").Delete
ShortcutMenus(xlWorksheetCell).MenuItems("Paste").Delete
ShortcutMenus(xlWorksheetCell).MenuItems("Paste Special...").Delete 'Note space and ...
On Error GoTo 0
End Sub

Note that I recoded the bit for PasteSpecial - getting the exact name of a menu item is important.
 
Upvote 0
That works a treat!!

Its always the obvious that gets missed!

Thank you for helping me out.

Can i be so bold as to ask one more question?

Is it possible to disable the cut, copy, paste and paste special from the drop down menus at the top, just for this spreadsheet?

Paul
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,770
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top