ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   listbox (https://www.excelbanter.com/excel-programming/276091-listbox.html)

jim C.

listbox
 
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?

jim C.

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


.



All times are GMT +1. The time now is 10:13 PM.

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