Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
right click menu
In my workbook, the user right clicks on the "List" sheet, a form is
displayed, and some code is run. I disable the right click menu with the following code: Sub Workbook_SheetActivate(ByVal Sh As Object) If Sh.Name = "List" Then Application.CommandBars("Cell").Enabled = False Else Application.CommandBars("Cell").Enabled = True End If Once the code is finished, I activate the "Results" sheet. On this sheet, I need the the right click feature to be available. Currently, when the code stops, the user sees the "Results" sheet, however the right click menu is displayed. It's annoying because the user right clicked on the 'List" sheet but not on the "Results" sheet. Is there a way to close the right click menu programatically? Thanks for the help.... End Sub -- JT |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
right click menu
I'm not sure I understand for sure, but maybe you could stop using that event
and just use the worksheet_beforerightclick under the List worksheet: Option Explicit Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean) Cancel = True UserForm1.Show End Sub Or maybe.. Option Explicit Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean) if intersect(target,me.range("a1:b9")) is nothing then 'do nothing else Cancel = True UserForm1.Show end if End Sub That way only rightclicking in A1:B9 would pop up that userform--everywhere else gets the popup. JT wrote: In my workbook, the user right clicks on the "List" sheet, a form is displayed, and some code is run. I disable the right click menu with the following code: Sub Workbook_SheetActivate(ByVal Sh As Object) If Sh.Name = "List" Then Application.CommandBars("Cell").Enabled = False Else Application.CommandBars("Cell").Enabled = True End If Once the code is finished, I activate the "Results" sheet. On this sheet, I need the the right click feature to be available. Currently, when the code stops, the user sees the "Results" sheet, however the right click menu is displayed. It's annoying because the user right clicked on the 'List" sheet but not on the "Results" sheet. Is there a way to close the right click menu programatically? Thanks for the help.... End Sub -- JT -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
right click menu
On Feb 22, 9:53 am, JT wrote:
In my workbook, the user right clicks on the "List" sheet, a form is displayed, and some code is run. I disable the right click menu with the following code: Sub Workbook_SheetActivate(ByVal Sh As Object) If Sh.Name = "List" Then Application.CommandBars("Cell").Enabled = False Else Application.CommandBars("Cell").Enabled = True End If Once the code is finished, I activate the "Results" sheet. On this sheet, I need the the right click feature to be available. Currently, when the code stops, the user sees the "Results" sheet, however the right click menu is displayed. It's annoying because the user right clicked on the 'List" sheet but not on the "Results" sheet. Is there a way to close the right click menu programatically? Thanks for the help.... End Sub -- JT Helo JT, You code is running after the event has taken place. Move your code to the Worksheet_BeforeRightClick() event on the "List" worksheet. Then your code will excute before the default Right_Click is processed by Excel. Sincerely, Leith Ross |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
right click menu
Thanks to both of you...that did the trick.......Thanks again
-- JT "Leith Ross" wrote: On Feb 22, 9:53 am, JT wrote: In my workbook, the user right clicks on the "List" sheet, a form is displayed, and some code is run. I disable the right click menu with the following code: Sub Workbook_SheetActivate(ByVal Sh As Object) If Sh.Name = "List" Then Application.CommandBars("Cell").Enabled = False Else Application.CommandBars("Cell").Enabled = True End If Once the code is finished, I activate the "Results" sheet. On this sheet, I need the the right click feature to be available. Currently, when the code stops, the user sees the "Results" sheet, however the right click menu is displayed. It's annoying because the user right clicked on the 'List" sheet but not on the "Results" sheet. Is there a way to close the right click menu programatically? Thanks for the help.... End Sub -- JT Helo JT, You code is running after the event has taken place. Move your code to the Worksheet_BeforeRightClick() event on the "List" worksheet. Then your code will excute before the default Right_Click is processed by Excel. Sincerely, Leith Ross |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Right click menu | Excel Programming | |||
Name of Right Click Menu | Excel Programming | |||
Add menu item to right-click menu | Excel Programming | |||
Adding a menu item right click menu when clicking on a single. | Excel Programming | |||
Adding menu to the mouse right click pop-up menu | Excel Programming |