LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 121
Default exit all subs? (from embedded sub)

I have a button on a sheet that calls a sub, and that sub calls other subs,
I might even have a third-level sub in there somewhere, and each of those
subs have plenty of code.

I just found out that there is a potential problem with files that are
auto-loaded behind the scenes; now I need to pop a messagebox to the user
with a few key pieces of info to confirm whether the source files are valid.
Unfortunately, the best place to do that is within an embedded sub.

So while I've used exit for and exit sub before, my understanding is that
they each only exit the current "level". If I exit this embedded sub, then
I'll still have the main calling sub run, which I don't want (because it
will try to run the bad data).

What is the appropriate way to stop or reset the processing of any/all VBA
code from within an embedded sub? it could be a serious re-write to try to
set a variable in multiple places to skip each chunk of code, so I'd prefer
to just stop the code altogether and let the user upload an appropriate
file, then restart.

Thanks for any help,
Keith

--
The enclosed questions or comments are entirely mine and don't represent the
thoughts, views, or policy of my employer. Any errors or omissions are my
own.


 
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
Combining two Subs Petitboeuf Excel Discussion (Misc queries) 6 April 27th 06 03:42 PM
Sort subs Gary''s Student Excel Programming 3 October 23rd 05 09:35 PM
Scope of Subs? Ken Loomis Excel Programming 9 August 6th 05 07:36 PM
ending subs [email protected] Excel Programming 2 May 17th 05 06:13 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 04:47 AM.

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"