ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   OnKey Help (https://www.excelbanter.com/excel-programming/377509-onkey-help.html)

jutlaux

OnKey Help
 
I want to assign a macro to the specific key strokes CTRL+down arrow and
have used the following syntax:

Sub Verification()
Application.OnKey "^{DOWN}", "MyShortcut"
End Sub

This works when the keys are pressed in the order CTRL then down arrow, but
if I hit the down arrow first then CTRL nothing happens. In most cases with
the "OnKey" the key order does not matter, but for some reason in this case
it does. How can I make it so the order of the keys in this case doesn't
matter?

Ardus Petus

OnKey Help
 
This is a general behaviour of Windows:
Ctrl (like Shift or Alt) must be pressed BEFORE any othe key.

These special keys toggle something in windows, so that subsequent
keypresses are interpreted in a a special context.

If you first press an ordinary key, Windows interprets it as a normal key

HTH
--
AP

"jutlaux" a écrit dans le message de
news: ...
I want to assign a macro to the specific key strokes CTRL+down arrow and
have used the following syntax:

Sub Verification()
Application.OnKey "^{DOWN}", "MyShortcut"
End Sub

This works when the keys are pressed in the order CTRL then down arrow,
but
if I hit the down arrow first then CTRL nothing happens. In most cases
with
the "OnKey" the key order does not matter, but for some reason in this
case
it does. How can I make it so the order of the keys in this case doesn't
matter?





All times are GMT +1. The time now is 04:01 PM.

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