![]() |
Handle keyboard events
How can I detect when a user presses Ctrl+Alt+G (or any similar key combination) while any worksheet is active? Thanks
|
Handle keyboard events
"Tatsujin" wrote in message
How can I detect when a user presses Ctrl+Alt+G (or any similar key combination) while any worksheet is active? Thanks If you only want to trap one or perhaps a handful of key combinations use Application.OnKey https://docs.microsoft.com/en-us/off...lication.onkey Sub CtrlAltG(bInit As Boolean) Application.OnKey "^%g", IIf(bInit, "TestCtrlAltG", "") End Sub Sub TestCtrlAltG() MsgBox "TestCtrlAltG" End Sub Don't forget to clear any OnKeys when done, for example in the workoks close event For something more general purpose look into use of the GetAsyncKeyState API, though Alt strokes probably won't pass through the sheet, so to speak. Some examples from long ago! https://groups.google.com/g/microsof...tAsyncKeyState Peter T |
All times are GMT +1. The time now is 03:29 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com