Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is it possible to select a row in a listbox in a userform with a right-click
and still have the right-click event? I have seen solutions for this in VB using the Windows API, but it doesn't seem possible with VBA. Thanks for any advice. RBS |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi RB
You'll probably need to fine tune it for your design. But this works here with Tahoma og various sizes.: Private Sub ListBox1_MouseDown(ByVal Button As Integer, _ ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) Dim L As Long If Button = 2 Then L = ListBox1.TopIndex + Int(Y / (ListBox1.Font.Size * 1.2)) ListBox1.ListIndex = L End If End Sub HTH. Best wishes Harald "RB Smissaert" skrev i melding ... Is it possible to select a row in a listbox in a userform with a right-click and still have the right-click event? I have seen solutions for this in VB using the Windows API, but it doesn't seem possible with VBA. Thanks for any advice. RBS |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Harald,
Thanks for that! Beautifully simple and it works perfect. Don't know why I hadn't come up with this myself. RBS "Harald Staff" wrote in message ... Hi RB You'll probably need to fine tune it for your design. But this works here with Tahoma og various sizes.: Private Sub ListBox1_MouseDown(ByVal Button As Integer, _ ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) Dim L As Long If Button = 2 Then L = ListBox1.TopIndex + Int(Y / (ListBox1.Font.Size * 1.2)) ListBox1.ListIndex = L End If End Sub HTH. Best wishes Harald "RB Smissaert" skrev i melding ... Is it possible to select a row in a listbox in a userform with a right-click and still have the right-click event? I have seen solutions for this in VB using the Windows API, but it doesn't seem possible with VBA. Thanks for any advice. RBS |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Glad to hear that. Thanks for the feedback.
Best wishes Harald "RB Smissaert" skrev i melding ... Harald, Thanks for that! Beautifully simple and it works perfect. Don't know why I hadn't come up with this myself. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Listbox in UserForm | Excel Discussion (Misc queries) | |||
UserForm Listbox in VBC | Excel Discussion (Misc queries) | |||
UserForm ListBox | Excel Programming | |||
Listbox on click | Excel Programming | |||
Is refreshing listbox rowsource in listbox click event possible? | Excel Programming |