PC Review


Reply
Thread Tools Rate Thread

Disable Right Click

 
 
=?Utf-8?B?S2FyZW41Mw==?=
Guest
Posts: n/a
 
      18th Sep 2007
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
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      18th Sep 2007
it works for me (i.e., right click menu does not pop up)... so I assume by
"not working" you mean you don't see the message that says right click is
disabled.. Add this as the last line of code before the End Sub line

MsgBox msg



--
Hope that helps.

Vergel Adriano


"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

 
Reply With Quote
 
JW
Guest
Posts: n/a
 
      18th Sep 2007
You are never displaying your message box for starters. You need to
add:
Msgbox msg

Also, make sure that you have this code in the module for the sheet
that you are trying to disable the right click for.
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


 
Reply With Quote
 
JW
Guest
Posts: n/a
 
      18th Sep 2007
Forgot to post the finalized code. Edited a bit and untested:
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" & _
Chr(10) & Chr(10) & "Make all changes on Main Page"
MsgBox msg
End Sub
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


 
Reply With Quote
 
=?Utf-8?B?S2FyZW41Mw==?=
Guest
Posts: n/a
 
      18th Sep 2007
Hi,

I've added the line msgbox msg, confimed my code is on the correct sheet but
it still allows me to right click. I am able to right click and rename the
sheet. Is there anything alse I need to do?

Thanks,

"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

 
Reply With Quote
 
=?Utf-8?B?S2FyZW41Mw==?=
Guest
Posts: n/a
 
      18th Sep 2007
Ok, this is weird. I've discovered I am locked out of right clicking on the
individual cells of the worksheet, not the sheet tab. How do I fix this?

"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

 
Reply With Quote
 
=?Utf-8?B?S2FyZW41Mw==?=
Guest
Posts: n/a
 
      18th Sep 2007
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

 
Reply With Quote
 
Jim Rech
Guest
Posts: n/a
 
      18th Sep 2007
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" <(E-Mail Removed)> wrote in message
news:689FBF8F-24A2-4B48-A3FF-(E-Mail Removed)...
|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


 
Reply With Quote
 
=?Utf-8?B?S2FyZW41Mw==?=
Guest
Posts: n/a
 
      18th Sep 2007
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" <(E-Mail Removed)> wrote in message
> news:689FBF8F-24A2-4B48-A3FF-(E-Mail Removed)...
> |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
>
>
>

 
Reply With Quote
 
JW
Guest
Posts: n/a
 
      18th Sep 2007
Ah, I had no idea you were talking about right-clicking on the sheet
tab. I assumed you were just talking about right-clicking in the
dccument. Glad you found a simple resolution.
Karen53 wrote:
> 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" <(E-Mail Removed)> wrote in message
> > news:689FBF8F-24A2-4B48-A3FF-(E-Mail Removed)...
> > |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
> >
> >
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable right click =?Utf-8?B?TkFXQlVT?= Windows XP Security 2 30th Jun 2005 10:00 PM
Disable the right click in IE6 hustedj Windows XP Internet Explorer 1 20th May 2004 06:19 AM
How to disable Right Click =?Utf-8?B?S2Ftcw==?= Microsoft Windows 2000 1 22nd Jan 2004 10:24 AM
Disable right click on Win XP =?Utf-8?B?QXlvdWI=?= Windows XP Security 1 6th Jan 2004 12:41 PM
Disable Right Click Terry Microsoft Windows 2000 Group Policy 3 19th Dec 2003 09:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:14 PM.