Who's my caller info?
You probably don't need all these possibilities:
Function doTest(Optional arg = "???")
Dim v As Variant
Select Case TypeName(Application.caller)
Case "Range"
v = Application.caller.Address
Case "String"
v = Application.caller
Case "Error"
v = "arg=" & arg
Case Else
v = "unknown"
End Select
doTest = "caller = " & v
End Function
Sub proc1()
Dim x As Variant
MsgBox doTest("proc1")
End Sub
Sub proc2()
Dim x As Variant
MsgBox doTest("proc2")
End Sub
count wrote:
Hi,
Is there a way or a trick to detect in a procedure the name of its caller?
TIA
Paul
|