F.A.Q.: Assign HotKey

Call VBA macro with a hotkey

This page contains the most recent questions we receive from our customers. Hope, you will find an answer here. However, this list is not complete. If you don't see your question here, please ask us using the Support Form. With your help we will create a comprehensive list with useful information. Please, do not hesitate to contact us - the more questions we receive, the better documentation you'll have. Download Now

How to assign Hot-Key to the VBA macro

In the Excel you can open properties of the VBA macro and assign Hot-Key combination to selected procedure.

Does this work with xlCompiler?

Unfortunately - No. xlCompare has no access to this information and doesn't load hot keys.

So, you should use a workaround. Excel allow to setup hotkey programmatically, using VBA macro statements.

Application.OnKey( Key, Procedure) method allows to assign a procedure to the hot-key combination.

We suggest you to add a Workbook_Open event to your workbook and define all hotkeys in one place.

You'll get code like this one:

Private Sub Workbook_Open()
  Application.OnKey "^w", "RebuildCharts"
End Sub

It assigns procedure RebuildCharts to the Strl+w key.

See Also:

More information on the Application.OnKey method