To define if a method has to be enabled in the menu /available as a keyboard shortcut in a given context, <ShellCommand(CanExecute prefix is used before the method name:
<ShellCommand(CanExecute:="<enablerfunction")> _
Public Sub subname()
...
where "enablerfunction" is a custom code that returns True if the context is appropriate. An example that checks if the context is text editing:
<ShellCommand(CanExecute:="Ena_TxtEdit")> _
Public Sub MouseWheel()
...
The custom function in the above example is:
Public Function Ena_TxtEdit() As Boolean
Return Text IsNot Nothing
End Function
See also