Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default GotFocus event

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default GotFocus event

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
"Dale Fye" wrote in message
...
|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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default GotFocus event

Jim,

I guess a work-around is better than nothing.
--
Email address is not valid.
Please reply to newsgroup only.


"Jim Rech" wrote:

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
"Dale Fye" wrote in message
...
|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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default GotFocus event

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)


"Dale Fye" wrote in message
...
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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Click event on menu item is lost after first time firing of the event [email protected] Excel Programming 1 April 2nd 07 01:25 PM
OLEObject.GotFocus Will Morgan Excel Programming 0 July 13th 06 10:07 PM
How to trap delete row event and hide column event? Alan Excel Programming 3 April 26th 05 04:25 PM
user form-on open event? keydown event? FSt1[_3_] Excel Programming 2 August 5th 04 02:26 PM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM


All times are GMT +1. The time now is 12:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"