Thread: Context menu
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
cmpcwil2[_29_] cmpcwil2[_29_] is offline
external usenet poster
 
Posts: 1
Default Context menu


I have a context menu to appear upon a right click of the mouse whilst
on a combo box. However the menu appears twice once when you right
click and then again upon selection of a menu item, I have implemented
the code above in a class module so not sure if this is the problem,
here is my code:

set up menu in module:

Dim NewControl As CommandBarControl
Set NewControl = Application.CommandBars("cell").Controls.Add
With NewControl
..Caption = "Clear Combo"
..BeginGroup = True
End With

call the menu from class module depending upon which combo box has
focus:
Sub ComboGroup_MouseDown(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)

If Button = 2 Then
CommandBars("cell").ShowPopup
ComboGroup.Text = ""
ComboGroup.clear


End If
End Sub

Can anyone help me on this? thanks


--
cmpcwil2
------------------------------------------------------------------------
cmpcwil2's Profile: http://www.excelforum.com/member.php...o&userid=33411
View this thread: http://www.excelforum.com/showthread...hreadid=550257