View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
PA PA is offline
external usenet poster
 
Posts: 101
Default Tell whether or not Sub B was called by Sub A?

Gary's solution is perfect if you don't want to call proc B directly (e.g By
a button) because you cannot call a proc with an argument directly.

If you would have top call b directly, you would need to call C that would
call B.

I'm not sure if this is clearer but bottom line, if gary's solution works
for you, go for it !

pa

"IanKR" wrote:

May be you could have an argument to sub B:

sub B(byval sCallerProc as string)
if sCallerProc=A then
....
else
....
endif
end sub

that won't work if B is called directly by the user. It will need to fire
sub C that will fire sub B.

I'm not sure if I'm clear.


I didn't follow the Sub C bit, I'm afraid. Gary's reply covers it, with the
optional argument.