My question is the following:
Is it possible to simply get in a procedure named B, called by a procedure named A, the name of the calling procedure (ie A)?
Thanks for your help
Caplande
My question is the following:
Is it possible to simply get in a procedure named B, called by a procedure named A, the name of the calling procedure (ie A)?
Thanks for your help
Caplande
You could passe the name of procedure A to procedure B when B is called:
Code:Public Sub subA() Call subB("subA") End Sub Public Sub subB(str As String) MsgBox str End Sub
If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
Bob Fitzpatrick
This is precisely what I want to avoid
If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
Bob Fitzpatrick
Sorry to have appeared unpleasant. It was not my goal, I just wanted to complete my question. Indeed, I had not indicated in my subject that I wanted to avoid this solution.
My apologies if you got hurt by my answer.
Suggest you rephrase your question then, because my interpretation of what you want is the same and I don't see any follow up post where you've clarified. I'm not saying I would have given the same answer, just that whatever "This" is in This is precisely what I want to avoid isn't clear.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
There is no direct way to do that. You might consider creating a global variable and set that = A before you call B, and then inside B you just read the variable. However Bob's suggestion to simply pass the name of the caller would work, and would be more maintainable.
There is a CodeContextObject in Access, but that only returns the current proc, not where it came from.
never tried it but suggest take a look at this link, see if meets your requirements
https://brainsnapped.com/2015/03/10/...-stack-in-vba/