I
IanKR
For example, if I have two Subs in my project, say A and B, and B may
sometimes be called from within A and at other times it may be run
independently of A, other than setting a global Boolean as illustrated
below, is there a slick way of telling?
Dim SubBCalledFromSubA as Boolean
Sub A()
'first reset Boolean, just in case
SubBCalledFromSubA = FALSE
.....
SubBCalledFromSubA = TRUE
Call B
....
'reset Boolean
SubBCalledFromSubA = FALSE
End Sub
Sub B()
If SubBCalledFromSubA = TRUE Then
'code here
End If
If SubBCalledFromSubA = FALSE Then
'some other code here
End If
End Sub
I thought that Application.Caller (or something similar) might be relevant
here, but it doesn't appear to be, judging by the help file.
Thanks
Ian
sometimes be called from within A and at other times it may be run
independently of A, other than setting a global Boolean as illustrated
below, is there a slick way of telling?
Dim SubBCalledFromSubA as Boolean
Sub A()
'first reset Boolean, just in case
SubBCalledFromSubA = FALSE
.....
SubBCalledFromSubA = TRUE
Call B
....
'reset Boolean
SubBCalledFromSubA = FALSE
End Sub
Sub B()
If SubBCalledFromSubA = TRUE Then
'code here
End If
If SubBCalledFromSubA = FALSE Then
'some other code here
End If
End Sub
I thought that Application.Caller (or something similar) might be relevant
here, but it doesn't appear to be, judging by the help file.
Thanks
Ian