Share via

VBA: ONKEY question

Anonymous
2012-10-29T09:04:59+00:00

hi,  i have been looking for the name given to the Windows key  (bottom left, middle of three keys, #59)

is it possible to select key by key number / how?  otherwise,  the example have is:

Application.OnKey "%{winkey}", "test"    'please help fix this line,  thanks

note:  recommend reestablish ability to mark own answers,  as answered.  i don't care if i don't get any kind of credit for it.  logically,  is otherwise just tricks vs bringing your numbers down.

==========    ANSWER:  found  (tidings, was told couldn't do it)

  • in using a key remapping program (key tweak),  i used remap of:  

key 59  (Left Windows)  to  F5  (in excel is:  GoTo popup, may as well have straight up winkey do something else when not using the ALT key).

 - in excel, thisworkbook,  placed:

Application.OnKey "%{F5}", "yourmacro"    'Alt-Left Windows key,  makes it happen

 - in submodule place your macro"

Sub yourmacro()

do what want

End Sub

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2012-10-30T07:57:36+00:00

    answer found:

    • in using a key remapping program (key tweak),  i used remap of:  

    key 59  (Left Windows)  to  F5  (in excel is:  GoTo popup, may as well have straight up winkey do something else when not using the ALT key).

     - in excel, thisworkbook,  placed:

    Application.OnKey "%{F5}", "yourmacro"    'Alt-Left Windows key,  makes it happen

     - in submodule place your macro"

    Sub yourmacro()

    do what want

    End Sub

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2012-10-29T21:23:54+00:00

    the problem is with the winkey portion,  can that be fixed to its correct name?

    Was this answer helpful?

    0 comments No comments