View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default Double click item in Listbox to select item and close Listbox

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