ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   identifying caller procedure (https://www.excelbanter.com/excel-programming/369362-identifying-caller-procedure.html)

Stefi

identifying caller procedure
 
Hi All,

Is there any feature in VBA for identifying a caller procedure? E.g. if Sub
C is called from Sub A and Sub B, i'd like to know in Sub C that it was
called from Sub A or Sub B.

Thanks,
Stefi


Jan Karel Pieterse

identifying caller procedure
 
Hi Stefi,

Is there any feature in VBA for identifying a caller procedure? E.g. if Sub
C is called from Sub A and Sub B, i'd like to know in Sub C that it was
called from Sub A or Sub B.


One way would be bt using an argument:

Sub A(sCaller as String)
Msgbox "I was called by: " & sCaller
End Sub

Sub B()
A "Sub B"
End Sub

Sub C()
A "Sub C"
End Sub

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
Member of:
Professional Office Developer Association
www.proofficedev.com


Stefi

identifying caller procedure
 
Thanks Jan Karel, I thought there is a built-in feature, but if there isn't
one, I'll use this method.
Stefi


€˛Jan Karel Pieterse€¯ ezt Ć*rta:

Hi Stefi,

Is there any feature in VBA for identifying a caller procedure? E.g. if Sub
C is called from Sub A and Sub B, i'd like to know in Sub C that it was
called from Sub A or Sub B.


One way would be bt using an argument:

Sub A(sCaller as String)
Msgbox "I was called by: " & sCaller
End Sub

Sub B()
A "Sub B"
End Sub

Sub C()
A "Sub C"
End Sub

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
Member of:
Professional Office Developer Association
www.proofficedev.com




All times are GMT +1. The time now is 01:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com