ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   disable right click menu (https://www.excelbanter.com/excel-programming/322133-disable-right-click-menu.html)

JT[_2_]

disable right click menu
 
I have a macro where when I right click on a cell, I get a
form to display through a private sub. However, once the
form is closed, the "usual" menu (cut, copy, insert, etc.)
you get when you right click is displayed.

Is there a way to disable the "usual" menu from appearing
on this worksheet only?

Thanks for the help.

Jake Marx[_3_]

disable right click menu
 
Hi JT,

I'm assuming that you've used the Worksheet_BeforeRightClick event. If
that's the case, insert this line of code somewhere in that routine:

Cancel = True

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


JT wrote:
I have a macro where when I right click on a cell, I get a
form to display through a private sub. However, once the
form is closed, the "usual" menu (cut, copy, insert, etc.)
you get when you right click is displayed.

Is there a way to disable the "usual" menu from appearing
on this worksheet only?

Thanks for the help.



Bob Phillips[_6_]

disable right click menu
 
Put this in the ThisWorkbook code module

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name = "Sheet1" Then
CommandBars("Cell").Enabled = False
Else
CommandBars("Cell").Enabled = True
End If
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"JT" wrote in message
...
I have a macro where when I right click on a cell, I get a
form to display through a private sub. However, once the
form is closed, the "usual" menu (cut, copy, insert, etc.)
you get when you right click is displayed.

Is there a way to disable the "usual" menu from appearing
on this worksheet only?

Thanks for the help.




Jim Thomlinson[_3_]

disable right click menu
 
Add

Cancel = True

One of the arguments of the sub is cancel and that refers to what would you
like to do with the normal drop down menu display.

HTH

"JT" wrote:

I have a macro where when I right click on a cell, I get a
form to display through a private sub. However, once the
form is closed, the "usual" menu (cut, copy, insert, etc.)
you get when you right click is displayed.

Is there a way to disable the "usual" menu from appearing
on this worksheet only?

Thanks for the help.


Bob Phillips[_6_]

disable right click menu
 
oops. missed a bit

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name = "Sheet1" Then
Application.CommandBars("Cell").Enabled = False
Else
Application.CommandBars("Cell").Enabled = True
End If
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Bob Phillips" wrote in message
...
Put this in the ThisWorkbook code module

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name = "Sheet1" Then
CommandBars("Cell").Enabled = False
Else
CommandBars("Cell").Enabled = True
End If
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"JT" wrote in message
...
I have a macro where when I right click on a cell, I get a
form to display through a private sub. However, once the
form is closed, the "usual" menu (cut, copy, insert, etc.)
you get when you right click is displayed.

Is there a way to disable the "usual" menu from appearing
on this worksheet only?

Thanks for the help.







All times are GMT +1. The time now is 08:15 AM.

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