XLShortcut_EnableDisable

Disables or Enables certain Excel built-in shortcut.
Code has example on how to disable or enable ALT+F11, which will open VBE in Excel

Sub XLShortcut_EnableDisable(sKey, Enable1_Disable2)
 ' %{F11} = ALT+F11
 If Enable1_Disable2 = 1 Then
  Application.OnKey sKey ' "%{F11}" ' Restore Alt + F11 functionality
 ElseIf Enable1_Disable2 = 2 Then
  Application.OnKey sKey, "" ' "%{F11}", "" ' Disable Alt + F11 functionality
 End If
End Sub


Sub EnableALT_F11()
 XLShortcut_EnableDisable "%{F11}", 1
End Sub
Sub DisableALT_F11()
 XLShortcut_EnableDisable "%{F11}", 2
End Sub

sKey, Enable1_Disable2

Views 773 Downloads 321

'ALT+F11', 'Excel', 'VBA', 'macro', 'macros', 'VBE', 'Visual Basic Editor', 'Excel', 'shortcut', 'enable', 'disable', 'keyboard', 'keys'

ANmarAmdeen
333
Components VBA-Excel
Revisions

v1.0