Does a neat trick include keeping track yourself?
Option Explicit
Public myParentCaller As String
Sub test1()
Dim myParentTemp As String
MsgBox "I got called from: " & myParentCaller
myParentTemp = myParentCaller
myParentCaller = "test1"
Call test2
myParentCaller = myParentTemp
MsgBox "I still got called from: " & myParentCaller
End Sub
Sub test2()
Dim myParentTemp As String
MsgBox "I got called from: " & myParentCaller
myParentTemp = myParentCaller
myParentCaller = "test2"
Call test3
myParentCaller = myParentTemp
MsgBox "I still got called from: " & myParentCaller
End Sub
Sub test3()
Dim myParentTemp As String
MsgBox "I got called from: " & myParentCaller
myParentTemp = myParentCaller
'no more calls, just in case...
myParentCaller = myParentTemp
MsgBox "I still got called from: " & myParentCaller
End Sub
count wrote:
Hi,
Is there a way or a trick to detect in a procedure the name of its caller?
TIA
Paul
--
Dave Peterson