ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable Right Click in Spreadsheet (https://www.excelbanter.com/excel-programming/341790-disable-right-click-spreadsheet.html)

Tywardreath

Disable Right Click in Spreadsheet
 
Hi

I've found the following code to disable right clicking with a spreadsheet,
however within Excel 2003 it doesn't work.

Private Sub Worksheet_BeforeRightClick(ByVal Target _
As Excel.Range, Cancel As Boolean)
Cancel = True 'prevents normal RClick menu from appearing
End Sub

Does anyone know how to stop right clicking?

Cheers, Ty

Gary Keramidas[_4_]

Disable Right Click in Spreadsheet
 
try this on the code page for this workbook:

Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target
As Range, Cancel As Boolean)
Cancel = True 'prevents normal RClick menu from appearing
End Sub

or put your code on each sheet's code page.

your code works here with excel 2k3

--


Gary


"Tywardreath" wrote in message
...
Hi

I've found the following code to disable right clicking with a
spreadsheet,
however within Excel 2003 it doesn't work.

Private Sub Worksheet_BeforeRightClick(ByVal Target _
As Excel.Range, Cancel As Boolean)
Cancel = True 'prevents normal RClick menu from appearing
End Sub

Does anyone know how to stop right clicking?

Cheers, Ty




Tom Ogilvy

Disable Right Click in Spreadsheet
 
It should work in xl2003. Perhaps you have security set to high and macros
have been silently disabled.

--
Regards,
Tom Ogilvy

"Tywardreath" wrote in message
...
Hi

I've found the following code to disable right clicking with a

spreadsheet,
however within Excel 2003 it doesn't work.

Private Sub Worksheet_BeforeRightClick(ByVal Target _
As Excel.Range, Cancel As Boolean)
Cancel = True 'prevents normal RClick menu from appearing
End Sub

Does anyone know how to stop right clicking?

Cheers, Ty




Tywardreath

Disable Right Click in Spreadsheet
 
Hi

This code did the trick.

Thanks :)
Ty




All times are GMT +1. The time now is 10:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com