Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 345
Default Stopping a 'multi-level' procedure

I have some longer macros that have the structu
sub toplevel()
call nextlevel 'or call nextlevel1(a,b,c)
'and in the nextlevel code
call lower_level 'or call lower_level2(d,e,f)

In many of the lower_level procedures there is error checking where 'exit
sub' is used to stop execution. It's getting tiresome to code all of the
'back track' conditions in order to stop the execution of the toplevel sub.

Is there an Excel vba way of immediately stopping the top most sub when a
lower level sub contains an error?

Thanks,
--
Neal Z
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Stopping a 'multi-level' procedure

Put the error handler only in the initial/toplevel routine. If an error
occurs, vba moves up the stack until it finds an error handler in one of the
calling routines. If it finds none, then it errors, otherwise the first
error handler it finds will handle the error. So you could end at that
point (in the top level routine).

--
Regards,
Tom Ogilvy

"Neal Zimm" wrote in message
...
I have some longer macros that have the structu
sub toplevel()
call nextlevel 'or call nextlevel1(a,b,c)
'and in the nextlevel code
call lower_level 'or call lower_level2(d,e,f)

In many of the lower_level procedures there is error checking where 'exit
sub' is used to stop execution. It's getting tiresome to code all of the
'back track' conditions in order to stop the execution of the toplevel

sub.

Is there an Excel vba way of immediately stopping the top most sub when a
lower level sub contains an error?

Thanks,
--
Neal Z



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
Costed Multi Level BOM RobN via OfficeKB.com Excel Discussion (Misc queries) 1 August 4th 08 06:40 PM
Multi-Level Subtotals Douglas Eckert Excel Discussion (Misc queries) 0 May 11th 07 03:51 PM
multi level worksheets Lesley Excel Discussion (Misc queries) 1 September 12th 06 04:53 AM
Multi Level Subtotals and SP2 amkazen Excel Worksheet Functions 3 March 1st 06 05:25 PM
Multi-level passwords Todor Excel Discussion (Misc queries) 7 June 7th 05 06:36 PM


All times are GMT +1. The time now is 02:22 PM.

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

About Us

"It's about Microsoft Excel"