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

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

DominicB

Well-known Member
Joined
Oct 3, 2005
Messages
1,569
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
 

Forum statistics

Threads
1,141,152
Messages
5,704,594
Members
421,358
Latest member
Redstar13

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
Top