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
' %{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 4,671
Downloads 1,375
CodeID
DB ID