I have a function that can be called from a commandbar on some forms or from ribbon or from other functions and subs.
How can I check the trigger? The function has been called from a commandbar or a function/sub?
For now, I ended up deleting the commandbar after each use and recreating it when necessary. Then used a syntax like following.
Is there any simpler way to check the trigger of a function?
Thanks.
How can I check the trigger? The function has been called from a commandbar or a function/sub?
For now, I ended up deleting the commandbar after each use and recreating it when necessary. Then used a syntax like following.
Is there any simpler way to check the trigger of a function?
Code:
Public Function MyFunction (Optional Params as string)
If isCommandBar("MyCommandBar") Then
Params = Nz(Application.CommandBars.ActionControl.Parameter, "")
End If
' Do Something Here
End Function
Thanks.
Last edited: