Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JT JT is offline
external usenet poster
 
Posts: 234
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default 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   Report Post  
Posted to microsoft.public.excel.programming
JT JT is offline
external usenet poster
 
Posts: 234
Default 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
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 menu ewagz Excel Programming 1 September 19th 06 06:45 AM
Name of Right Click Menu Desert Piranha[_92_] Excel Programming 6 August 2nd 06 09:42 AM
Add menu item to right-click menu [email protected] Excel Programming 1 July 15th 06 10:32 AM
Adding a menu item right click menu when clicking on a single. Andoni[_28_] Excel Programming 0 September 2nd 04 10:23 PM
Adding menu to the mouse right click pop-up menu Jack Excel Programming 1 February 12th 04 05:23 AM


All times are GMT +1. The time now is 06:52 AM.

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"