ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Use Keyboard with KeyDown and KeyUp (https://www.excelbanter.com/excel-programming/397965-use-keyboard-keydown-keyup.html)

Donny

Use Keyboard with KeyDown and KeyUp
 
I am working on a sheet that has keyboard shortcuts. I want to use
keyboard buttons to control the worksheet. For example, if I press
the "q" key down, I want TextBox1 to appear. When the "q" key is
released (KeyUP), TextBox1 should go away.
TextBox1 can be generated in the code under the KeyDown sub, and
deleted after KeyUp, I just don't know how to catch the keyboard key
actions with KeyDown and KeyUp.

Thanks,
Donny


Leith Ross[_2_]

Use Keyboard with KeyDown and KeyUp
 
On Sep 22, 10:01 am, Donny wrote:
I am working on a sheet that has keyboard shortcuts. I want to use
keyboard buttons to control the worksheet. For example, if I press
the "q" key down, I want TextBox1 to appear. When the "q" key is
released (KeyUP), TextBox1 should go away.
TextBox1 can be generated in the code under the KeyDown sub, and
deleted after KeyUp, I just don't know how to catch the keyboard key
actions with KeyDown and KeyUp.

Thanks,
Donny


Hello Donny,

You can catch the KeyUp and KeyDown events on a VBA UserForm. There
are no equivalent events for an Excel Worksheet. Although a short cut
key can be assign directly to macro, this doesn't mean keyboard events
are also associated with the same macro automatically. Up and down
movement of Worksheet keystrokes can only be monitored by using
advanced API code techniques.

Sincerely,
Leith Ross



All times are GMT +1. The time now is 10:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com