ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   combobox close on mouse move (https://www.excelbanter.com/excel-programming/430703-combobox-close-mouse-move.html)

sunilpatel

combobox close on mouse move
 

Is it possible for a combobox dropdown list to close (as if a selection was
made), if the mouse moves out of the list. I notice the pointer chances from
a cross to the normal pointer as the mouse moves off the list.

I would ideally like to mimic a mouse clixk on the top item if the mouse
moves off the list.

Hope this is clear


Thanks



jamescox[_85_]

combobox close on mouse move
 


You may get a better answer, but I don't think you can use the
_MouseMove to get what you want.

You can experiment with the events of a combobox by creating one on a
worksheet and then creating the event subs for the events you want to
learn about. At the top of the worksheet code put:

Public lEvent as Long

Then add to to the event sub some code like:

Private Sub ComboBox1_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)

lEvent = lEvent + 1
Debug.Print "mouse moved " & CStr(lEvent)

End Sub

Then, postion the VB IDE Immediate window where you can see it and
still be able to interact with the combo box on the worksheet and watch
which events your actions trigger.

In this case, the _MouseMove fires repeatedly as the mouse moves around
inside the combo box after the choices have been displayed, but stops
firing when the mouse moves out of the combobox border.

You may be able to do what you want with the _LostFocus event which
fires after the combo box has been selected and then the user clicks off
it onto a worksheet cell or some other control.

Hope this helps...


--
jamescox
------------------------------------------------------------------------
jamescox's Profile: http://www.thecodecage.com/forumz/member.php?userid=449
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=112648



All times are GMT +1. The time now is 08:29 AM.

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