Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Can't disable RIGHT CLICK

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Can't disable RIGHT CLICK

It should be ByRef Cancel or simply Cancel, not ByVal. Always best to select
event stubs from the dropdown.

Regards,
Peter T

"AP" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Right Click - Disable item Steven Excel Programming 1 February 27th 10 12:17 PM
Disable Right Click Karen53 Excel Programming 9 September 18th 07 09:12 PM
Disable Right click No Name Excel Programming 3 September 24th 04 03:27 PM
Disable right-click fredbibi49 Excel Programming 1 June 14th 04 10:44 AM
Disable right click Rich Cooper Excel Programming 2 May 14th 04 02:54 PM


All times are GMT +1. The time now is 10:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"