Tell whether or not Sub B was called by Sub A?
'/-----------------------------------/
Sub A()
Dim SubBCalledFromSubA As Boolean
'first reset Boolean, just in case
SubBCalledFromSubA = False
' .....
SubBCalledFromSubA = True
Call B(SubBCalledFromSubA)
' ....
'reset Boolean
SubBCalledFromSubA = False
End Sub
'/-----------------------------------/
Sub B(Optional blnCheck)
If IsMissing(blnCheck) Then blnCheck = True
If blnCheck = True Then
'code here
MsgBox "It's True!"
End If
If blnCheck = False Then
'some other code here
MsgBox "It's False :O<"
End If
End Sub
'/-----------------------------------/
--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown
Many thanks, Gary - "Yes"!
|