Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keydown event for every control in a form

Status
Not open for further replies.

Enkay62

Programmer
Sep 5, 2003
78
IT
Hi.
In an excel 2000 wb I've built a lot of forms with many controls.
Unfortunately, I realized that I've forgotten some code in keydown event for all textboxes & commandbuttons in all my forms.
In order to avoid writing the same code for all the controls in all forms (about 30 userforms with about 5 controls in each form), how can I write code in each userform valid for any control of its.
I figured something like
For each ctrl in userform1.controls
................
but it didn't work.
Besides, once I've found the code, it should be referred only to controls which accept keydown event (not labels etc..).
Anybody can help me?
Thank you.
Nick
 
Why not simply use the KeyDown event of the form itself ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
I think the only thing you can do is call a function from each button/form KeyDown event, but obviously you still need to add a line of code to each event.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top