Trap Enter Key

J

JamesJ

Not having much luck trapping the enter key in the
On Key Press of a Lisy Box. I'm using:

If KeyCode = vbKeyReturn Then

Getting a 'Variable not defined' in the KeyCode.
I had code for this but can't find it.

Thanks,
James
 
R

RoyVidar

JamesJ said:
Not having much luck trapping the enter key in the
On Key Press of a Lisy Box. I'm using:

If KeyCode = vbKeyReturn Then

Getting a 'Variable not defined' in the KeyCode.
I had code for this but can't find it.

Thanks,
James

Keys that causes focus to change, isn't trapped in the KeyPressed
event of that control, I think, but the KeyPressed of the next control
in the tab order.

Try using the controls KeyDown event in stead (which has a KeyCode
arguement)
 

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