View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default If a called sub exit, how to the caller exit right away?

Hi
one way:
make your second sub a function which return FALSE or an error code. In
your main sub you can use somethin like

sub main_sub()
....
ret = subfunction2
If not ret then exit sub
....
end sub


--
Regards
Frank Kabel
Frankfurt, Germany

luvgreen wrote:
Good morning! I have a question to ask experts. The main sub will a
sub2, if there is error in sub2, sub2 will pop a message and exit.
How can I make the main sub exit right away without running other
code behind calling sub2? thanks.