View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Karen53 Karen53 is offline
external usenet poster
 
Posts: 333
Default Disable Right Click

Thanks Jim,

I've discovered protecting the workbook structure will do the same thing,
and it's safer. Thanks for the info.

"Jim Rech" wrote:

Excel exposes a limited number of events that we can write code handlers
for. The cell right before click event is one of them but there is no event
for many other events including right-clicking a worksheet tab.

You can disable this pop up menu however if you run this code when the
workbook opens (in WorkBook_Open event or sub Auto_Open):

CommandBars("Ply").Enabled = False

But!

That code makes a permanent change to the users' toolbars which they will
not be happy about you doing. So be sure to change it back when your
workbook closes (Workbook_BeforeClose or sub Auto_Close).

CommandBars("Ply").Enabled = True
--
Jim
"Karen53" wrote in message
...
|I take it I can't turn off the right click on the sheet tab?
|
| "Karen53" wrote:
|
| Hi,
|
| All of my research says this is the correct formula. However it is not
| working. Am I missing something?
|
| Private Sub Worksheet_BeforeRightClick _
| (ByVal Target As Range, Cancel As Boolean)
| 'Turn off right mouse click and display message
| Dim msg As String
|
| Cancel = True
| msg = ("You are not authorized to delete this sheet") & vbCtlf
| msg = msg & vbCtlf
| msg = msg & ("Make all changes on Main Page")
|
| End Sub
|
|
| Thanks