Search code examples
excelvbamacoskeyboard-shortcuts

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


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

Solution

  • As per FunThomas's link https://learn.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".