#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Exit Sub


I have a subroutine which calls another subroutine. The child subroutine
has an error mechanism that displays a message and then is supposed to
exit out of the subroutine. Exit Sub only works for the child
subroutine, however, and the main subroutine which called the child
subroutine still runs. Is there a call or command to exit out of
everything? Thanks in advance.


--
Raman325
------------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=544854

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Exit Sub

Yes: Exit Sub

"Raman325" wrote:


I have a subroutine which calls another subroutine. The child subroutine
has an error mechanism that displays a message and then is supposed to
exit out of the subroutine. Exit Sub only works for the child
subroutine, however, and the main subroutine which called the child
subroutine still runs. Is there a call or command to exit out of
everything? Thanks in advance.


--
Raman325
------------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=544854


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Exit Sub

A couple of common techniques a

1. Use a global boolean variable and set that in each subroutine. Then you can
examine that to see if you should quit or continue.

2. Another way would be to change your child subroutines to functions. Let
them return a boolean variable that you can check.



Raman325 wrote:

I have a subroutine which calls another subroutine. The child subroutine
has an error mechanism that displays a message and then is supposed to
exit out of the subroutine. Exit Sub only works for the child
subroutine, however, and the main subroutine which called the child
subroutine still runs. Is there a call or command to exit out of
everything? Thanks in advance.

--
Raman325
------------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=544854


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Exit Sub


Thank you for all the responses, that helps a lot.


--
Raman325
------------------------------------------------------------------------
Raman325's Profile: http://www.excelforum.com/member.php...o&userid=24748
View this thread: http://www.excelforum.com/showthread...hreadid=544854

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Exit Sub

You can use the End statement. Be aware that it clears all variables as
well as ending code execution.

--
Jim
"Raman325" wrote in
message ...
|
| I have a subroutine which calls another subroutine. The child subroutine
| has an error mechanism that displays a message and then is supposed to
| exit out of the subroutine. Exit Sub only works for the child
| subroutine, however, and the main subroutine which called the child
| subroutine still runs. Is there a call or command to exit out of
| everything? Thanks in advance.
|
|
| --
| Raman325
| ------------------------------------------------------------------------
| Raman325's Profile:
http://www.excelforum.com/member.php...o&userid=24748
| View this thread: http://www.excelforum.com/showthread...hreadid=544854
|




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exit Sub Jeff Excel Discussion (Misc queries) 2 March 1st 08 06:21 PM
If Then Else with Exit For [email protected] Excel Programming 9 December 21st 05 04:27 PM
how to exit sub xiang Excel Programming 3 December 9th 05 05:46 AM
Exit when its a Mac jose luis Excel Programming 0 September 20th 04 10:47 PM
If a called sub exit, how to the caller exit right away? luvgreen[_4_] Excel Programming 4 February 24th 04 05:06 PM


All times are GMT +1. The time now is 10:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"