Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Have a large complicated VBA Project in which the first item after it starts
is displaying a Listbox with 30 items (single select). Now the user must select the item and click the OK Button (it works). But from a windows GUI viewpoint they should be able to just double click the desired item and have it work the same as select and click OK. I have looked all through the Properties Window but see nothing to make it work. Just want to make it work like a real Windows App. XP Pro - Excel 2003 Any help (even if can't be done) would be appreciated. -- Gus Evans |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Have a large complicated VBA Project in which the first item after it
starts is displaying a Listbox with 30 items (single select). Now the user must select the item and click the OK Button (it works). But from a windows GUI viewpoint they should be able to just double click the desired item and have it work the same as select and click OK. I have looked all through the Properties Window but see nothing to make it work. Just want to make it work like a real Windows App. XP Pro - Excel 2003 Assuming your OK button is an ActiveX control named CommandButton1 for this example (user your actual control's name, of course), just put this one line in the ListBox's DoubleClick event... CommandButton1_Click and double clicking an item will do the same as selecting an item and clicking the CommandButton. Rick |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Great - worked like a charm!
-- Gus Evans "Rick Rothstein (MVP - VB)" wrote: Have a large complicated VBA Project in which the first item after it starts is displaying a Listbox with 30 items (single select). Now the user must select the item and click the OK Button (it works). But from a windows GUI viewpoint they should be able to just double click the desired item and have it work the same as select and click OK. I have looked all through the Properties Window but see nothing to make it work. Just want to make it work like a real Windows App. XP Pro - Excel 2003 Assuming your OK button is an ActiveX control named CommandButton1 for this example (user your actual control's name, of course), just put this one line in the ListBox's DoubleClick event... CommandButton1_Click and double clicking an item will do the same as selecting an item and clicking the CommandButton. Rick |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Gus
You could do it using code like that listed below Option Explicit Dim LstSelection As String Private Sub CommandButton1_Click() Call DoYourThingHere End Sub Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean) Call DoYourThingHere End Sub Sub DoYourThingHere() LstSelection = ListBox1.Value MsgBox LstSelection ListBox1.Visible = False End Sub hope this helps S |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ListBox3.ListIndex = ListBox3.ListCount -- How to select the last item in a Listbox? | Excel Programming | |||
listbox add item | Excel Programming | |||
Need selected item from listbox after double click | Excel Programming | |||
select listbox item automatically | Excel Programming | |||
Select an item in a listbox using code | Excel Programming |