Reputation: 6529
How do you check where an Excel VBA Sub is called from? It's easy enough to hit CTRL+F to find where in the code it may be called, but suppose there's an obscure hidden button that calls the Sub. How would you know?
Upvotes: 1
Views: 4485
Reputation: 19067
Even if you use CTRL+F in IDE you won't find the situation when standard form button is set to run that macro on action
. Moreover, any of shape within your Workbook could have on action
set to your sub. You would then need to check each of it.
But if you need to check such situation during compilation you could use something like:
Debug.Print Application.Caller
If your sub would be started from standard button then you get information Button 1
or shape name
if was start from any other shape. Important! You would require error handling procedure if you use that check syntax for situation when your sub is called from other sub.
For other check Santosh idea, yours, and finally you could write some code which search all modules to find your sub and list it.
Upvotes: 0