Home > OS >  VBA User defined Application.OnKey Shortcut using the Mac COMMAND ⌘ key
VBA User defined Application.OnKey Shortcut using the Mac COMMAND ⌘ key

Time:08-08

I'm trying to make a user-defined shortcut keys for Mac Excel in VBA, where I can use the COMMAND modifier key.

I can only find symbols for CTRL (^), ALT (%) and SHIFT ( ), but not the command button. Here's a subroutine where I would like to replace the ^ symbol for something that implies use of the command button:

Sub createShortcuts()
Application.OnKey " ^{H}", "helpMenu"
Application.OnKey " ^{I}", "Encapsulate_IFERROR"
End Sub

CodePudding user response:

As per FunThomas's link https://docs.microsoft.com/en-us/office/vba/api/excel.application.onkey

"There is no way to currently detect the Command key in recent versions of Office VBA. Microsoft is aware of this and is looking into it".

  • Related