Error Handling in Excel VBA Outside of Sub -


i know title bit confusing, problem have. have 1 sheet functions wrapper of sorts. has ability run multitude of macros sequentially, done through userform. basically, check box, if it's checked, runs macro. i'm trying is, if there error, want return either sub in.

my first idea in if statement checkboxes run subs put on error statement, didn't work, since error handling goes sub called , ignores before it.

what should do? possible?

you this:

sub errorhandler()   on error goto errhandler     call proc1     call proc2     call proc3   exit sub errhandler:     msgbox err.source & vbcrlf & err.description end sub   sub proc1()     on error goto errhandler     ' code block start      ' code block end   exit sub errhandler:     err.raise 513, "proc1", "customer error message 1|" & err.description end sub   sub proc2()     on error goto errhandler     ' code block start      ' code block end   exit sub errhandler:     err.raise 513, "proc2", "customer error message 2|" & err.description end sub   sub proc3()     on error goto errhandler     ' code block start      ' code block end   exit sub errhandler:     err.raise 513, "proc3", "customer error message 3|" & err.description end sub 

Comments