Right Click & Copy Sheet

poleary2000

Active Member
Joined
Apr 1, 2002
Messages
354
Can I turn off the ability to Right Click and Copy a Sheet witin Excel using VBA? This would have to work for all sheets currently in the workbook and all sheets that will be added. Please help!
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Hi Patrick,

You can disable the Move/Copy option in the right-click popup menu with the code:

Sub DisableCopy()
CommandBars("Ply").Controls("&Move or Copy...").Enabled = False
End Sub


This disables it for the Excel application, so will apply to all sheets.

Put this in a standard macro module in the workbook (keyboard Alt-TMV, then Alt-IM, paste code into VBE code pane). To run the macro go back to Excel, type Alt-TMM, select macro and Run.

Don't forget to set it back to True when done. To automatically reset it when the workbook closes, put the statement that resets it into the ThisWorkbook Close event (right-click on the Excel icon at the left end of the Worksheet Menu Toolbar, select View code and enter

Private Sub Workbook_BeforeClose(Cancel As Boolean)
CommandBars("Ply").Controls("&Move or Copy...").Enabled = True
End Sub-
 
Upvote 0
Hi again Patrick,

Oops. The BeforeClose should have been

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Ply").Controls("&Move or Copy...").Enabled = True
End Sub

Damon
 
Upvote 0
Damon,

This works whenever it is pasted into the code for activating a worksheet. However, when I try to reset it to TRUE on Workbook Close or Workbook Deactivation, I receive an error stating the block was not defined.

Any insight?
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,384
Members
449,080
Latest member
Armadillos

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