Hello,
I would like to test if a procedure is called directly by the user (so it is on top of the call stack, see ctrl+L in debug mode) or called from another procedure.
Does someone know a way to do this without tracking the call stack in a parameter passed in each procedure?
I tried to do this using a public parameter topOfCallStackFound and then adding to each procedure some code like:
But this doesn't work because VBA remembers the value of topOfCallStackFound after code execution is finished! The lifetime of topOfCallStackFound only ends when the workbook is closed, an end command is given or in a few other not useful circumstances. If it is possible to end the lifetime of topOfCallStackFound when code execution is finished and/or reinitialize topOfCallStackFound to false when the user starts new code execution, my problem would be solved. But other solutions are of course also greatly appreciated.![]()
Please Login or Register to view this content.
Thanks!
Bookmarks