Removing Cut, copy and Paste

Daniel C

New Member
Joined
Mar 3, 2006
Messages
10
Hi
using the search facility i've cobbeld together this code in order to help remove the cut copy and paste functions.

Private Sub Workbook_Open()
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
Application.CommandBars("Standard").Visible = False
End sub

However you can still use the the Worksheet command bar > Edit > cut

I originally thought that may be
Application.CommandBars("worksheet menu bar").Visible = False

would work but to no avail, what should i do?
Dan
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Good afternoon Daniel C

Try this :

Code:
Sub Test()
Dim ctrl As Object, ctrlMenuItem As Object
For Each ctrl In CommandBars("Worksheet Menu Bar").Controls
If ctrl.Caption = "&Edit" Then
For Each ctrlMenuItem In ctrl.Controls
If ctrlMenuItem.Caption = "Cu&t" Then ctrlMenuItem.Enabled = False ' Change to true to restore
If ctrlMenuItem.Caption = "&Copy" Then ctrlMenuItem.Enabled = False ' Change to true to restore
Next ctrlMenuItem
End If
Next ctrl
End Sub

FWIW, Ivan F Moala has put together a routine which prevents copying and pasting here :

http://www.xcelfiles.com/VBA_Quick13.html

HTH

DominicB
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,701
Members
448,980
Latest member
CarlosWin

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