Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Costed Multi Level BOM | Excel Discussion (Misc queries) | |||
Multi-Level Subtotals | Excel Discussion (Misc queries) | |||
multi level worksheets | Excel Discussion (Misc queries) | |||
Multi Level Subtotals and SP2 | Excel Worksheet Functions | |||
Multi-level passwords | Excel Discussion (Misc queries) |