title: How to run a VBA add-in macro from Excel using the Application.OnKey shortcut?
body: <p>I have an <strong>Excel add-in</strong> in which I have several macros, some that have the <code>Application.OnKey</code> method to enable the user to use a specific <strong>keyboard shortcut</strong> to run a certain macro. </p>
  
  <p>Accessing the code in the add-in requires a password. </p>
  
  <p>This is a simple example of a macro:</p>
  
  <pre><code>Sub refreshMySelection()
  Application.Selection.Calculate
  Application.OnKey "^{ENTER}", "refreshMySelection"
  End Sub
  </code></pre>
  
  <p>This is meant to allow the user to refresh selected Excel cells by only typing <kbd>Ctrl</kbd>+<kbd>Enter</kbd>.</p>
  
  <p>However, for some reason, <strong>Excel does not automatically recognize this shortcut</strong>. Unless I manually open the add-in and execute the above macro, then only the current active workbook would do the job i.e. refresh selected cells when typing <kbd>Ctrl</kbd>+<kbd>Enter</kbd>.</p>