simulating a key press

  • Thread starter Thread starter Sarah
  • Start date Start date
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
 
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
 
Back
Top