user form-on open event? keydown event?

  • Thread starter Thread starter FSt1
  • Start date Start date
F

FSt1

Does a user form have an on open event and a keydown
event. if so how do i set them. i have the code. i just
don't know how to trigger it.
 
Hi

Yes. Rightclick it in the VB editor, choose View Code, to get to its module.
There, choose "Userform" in the top left dropdown and KeyDown in the top
right to generate the event code. "Initialize" runs on load and "Activate"
on every show.

However, a userform Keydown won't run if you type into a control like a
textbox. You need that control's KeyDown event for that, there is no
keypreview property to help.

HTH. Best wishes Harald
 
thanks Harald
-----Original Message-----
Hi

Yes. Rightclick it in the VB editor, choose View Code, to get to its module.
There, choose "Userform" in the top left dropdown and KeyDown in the top
right to generate the event code. "Initialize" runs on load and "Activate"
on every show.

However, a userform Keydown won't run if you type into a control like a
textbox. You need that control's KeyDown event for that, there is no
keypreview property to help.

HTH. Best wishes Harald

"FSt1" <[email protected]> skrev i melding


.
 

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

Back
Top