Thread: listbox
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
jim C. jim C. is offline
external usenet poster
 
Posts: 15
Default listbox

ok, figured out how to add shortcut menu to mousedown
event... my next question is when mousedown event detects
button 2 and executes code, how can i select the item the
pointer is currently pointing at. for instance,
rightclick a cell on a worksheet and the cell is selected
and the shorcut menu is displayed.




-----Original Message-----

"jim c." wrote in message
...
is there a way to add a rightclick mouse event to a
listbox control? or a rightclick event to the whole
userform? using windows api's maybe?


Use the mousedown event

Private Sub ListBox1_MouseDown(ByVal Button As Integer,

ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
If Button = 2 Then 'Right Mouse button is 2
' Do your stuff
End If

End Sub

Keith


.