simulating a key press

S

Sarah

hi

How do I write code to simulate the Esc key being pressed? I want to put
this in one of my Subs, then step through the code. I can't use the 'On Key
Press' event because I'm not actually hitting the Esc key.

thanks in advance - Sarah
 
A

Allen Browne

You can use SendKeys to stuff Chr(27) into the keyboard buffer.

But there is almost certainly a better way to do this.
For example, if you are trying to undo the edits in the form, use:
Me.Undo
 

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