PC Review


Reply
Thread Tools Rate Thread

Can't disable RIGHT CLICK

 
 
AP
Guest
Posts: n/a
 
      11th Jun 2010
I'm trying to disable right-clicking of all sheets except in the sheet
named "Home". I've put the following code, as recommended by VBE help,
in the "ThisWorkbook" object module:

Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal
Target As Range, ByVal Cancel As Boolean)
If Sh.name <> "Home" Then Cancel = True
End Sub

But I keep getting the following error when I open the workbook:

"Compile error: Procedure declaration does not match description of
event or procedure having the same name"

It's driving me nuts as I don't have another procedure with the same
name ! Any help would be greatly appreciated.
 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      11th Jun 2010
It should be ByRef Cancel or simply Cancel, not ByVal. Always best to select
event stubs from the dropdown.

Regards,
Peter T

"AP" <(E-Mail Removed)> wrote in message
news:07b6d468-48dd-4bf6-9dd7-(E-Mail Removed)...
> I'm trying to disable right-clicking of all sheets except in the sheet
> named "Home". I've put the following code, as recommended by VBE help,
> in the "ThisWorkbook" object module:
>
> Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal
> Target As Range, ByVal Cancel As Boolean)
> If Sh.name <> "Home" Then Cancel = True
> End Sub
>
> But I keep getting the following error when I open the workbook:
>
> "Compile error: Procedure declaration does not match description of
> event or procedure having the same name"
>
> It's driving me nuts as I don't have another procedure with the same
> name ! Any help would be greatly appreciated.


 
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 01:19 PM.