How to get Last Key or Key-Combo Pressed (Not Event)?

Joined
Nov 25, 2010
Messages
6
Reaction score
0
hi

i'd like to get the last key or key-combo pressed.
Windows API method is fine, or VBA.

Note: I need to get this several seconds AFTER the key is released. I do not care about the current state of the key. I'm not trying to run a macro in response to a keypress. Not trying to capture the keypress event. So, getasynckeystate and OnKey are NOT the appropriate solutions for this. The key might be pressed while a macro is running, and i want to allow the macro to finish running without interruption, and only get the last key pressed after the key has already been released, possibly several seconds before. I believe that the operating system has a keyboard buffer, which retains last keypress indefinitely, until the next keypress. I want to read that buffer.

I'm not trying to detect any specific key, just want to get last keypress, whatever key it was.

The method should be able to detect special keys, like home, end, left, right, down, and up.

It should also recognize key combinations, like control alt and shift.

Using Excel 2007.

Thanks!

also posted here:
http://www.vbaexpress.com/forum/showthread.php?p=273634
and here
http://www.excelforum.com/excel-pro...-last-key-or-key-combo-pressed-not-event.html
 
Back
Top