GotFocus event

G

Guest

I do most of my work in Access, and would like to know if there is a GotFocus
event for Excel combo boxes. I like to setup my forms to limit the users
need to use the mouse, so I generally set my combo boxes to dropdown
automatically in the GotFocus event of a control.

I could not find this event associated with my controls (Excel 2003), so I'm
trying to use the Enter event instead. This works if I click in the control,
or if I am tabbing from a textbox into the combo box, but if I tab out of a
control that is currently dropped down, then the next combo box doesn't drop
down. If I select the item in a combo, then tab into the next combo it works
properly.

Any ideas?
 
J

Jim Rech

but if I tab out of a | control that is currently dropped down

That's exactly the problem. It seems that the second combo will not drop
down until the first is fully closed and there seems a lag in the 'fully
closed' part.

But I got it to work by having the combo call another sub Ontime to do the
drop down:

Private Sub ComboBox2_Enter()
''//ComboBox2.DropDown
Application.OnTime Now, "DoDropCombo2"
End Sub

''This code MUST go in a standard module.
Sub DoDropCombo2()
UserForm1.ComboBox2.DropDown
End Sub


--
Jim
|I do most of my work in Access, and would like to know if there is a
GotFocus
| event for Excel combo boxes. I like to setup my forms to limit the users
| need to use the mouse, so I generally set my combo boxes to dropdown
| automatically in the GotFocus event of a control.
|
| I could not find this event associated with my controls (Excel 2003), so
I'm
| trying to use the Enter event instead. This works if I click in the
control,
| or if I am tabbing from a textbox into the combo box, but if I tab out of
a
| control that is currently dropped down, then the next combo box doesn't
drop
| down. If I select the item in a combo, then tab into the next combo it
works
| properly.
|
| Any ideas?
| --
| Email address is not valid.
| Please reply to newsgroup only.
 
C

Chip Pearson

Use the Enter event. It is fired when the control gets focus.

Private Sub ComboBox1_Enter()
' your code here
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top