+ Reply to Thread
Results 1 to 4 of 4

On error print message and stop execution of subsequent subrotine

  1. #1
    Forum Contributor
    Join Date
    02-05-2015
    Location
    czech
    MS-Off Ver
    2010
    Posts
    172

    On error print message and stop execution of subsequent subrotine

    I have routine which contains many soubroutines. I've error handling code inside every subroutine or function. The problem is that the execution will not stop after an error.
    In the following code, if an error occurs in the sroute1, the execution wil continue with the sroute2 and that is unwanted behaviour. Is it somehow possible to print a message and immediately stop the execution?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: On error print message and stop execution of subsequent subrotine

    Utilize a public boolean variable. Example:

    Please Login or Register  to view this content.
    If you are happy with my response please click the * in the lower left of my post.

  3. #3
    Forum Contributor
    Join Date
    02-05-2015
    Location
    czech
    MS-Off Ver
    2010
    Posts
    172

    Re: On error print message and stop execution of subsequent subrotine

    Thank you very much. I hopped for oneliner, but this will suffice.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: On error print message and stop execution of subsequent subrotine

    Still not a one liner but, maybe this:

    Please Login or Register  to view this content.

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to stop error message
    By scudo in forum Excel General
    Replies: 3
    Last Post: 06-01-2015, 12:20 PM
  2. Replies: 0
    Last Post: 07-31-2006, 10:28 AM
  3. [SOLVED] Macro 'Code execution has been interupted' error after print?
    By Bluehair the Pirate in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-09-2006, 02:25 PM
  4. Aborting Execution Before Error Message
    By MWS in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-13-2005, 10:50 AM
  5. Stop Error Message
    By phil in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-26-2005, 01:06 PM
  6. [SOLVED] stop error message
    By phil in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-22-2005, 12:06 PM
  7. stop error message
    By phil in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-22-2005, 12:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1