+ Reply to Thread
Results 1 to 3 of 3

Stop procedure completely without error

  1. #1
    Registered User
    Join Date
    03-23-2012
    Location
    Boston, MA
    MS-Off Ver
    Excel 2010
    Posts
    7

    Stop procedure completely without error

    Hello,

    When we want to end a procedure (that's been called by another sub routine) within an error handler, we just use END. This prevents the error handler from passing back up to the original sub routine that called the procedure in the first place. This is great.

    However when we use End from within a form, it doesn't end, it continues on executing code (see example below). After our app presents a user form, if the user hits cancel we want to END the entire procedure and execute no more code. Putting "END" in the code for the cancel button still passes the procedure back up to the main system and continues executing code. We want to end everything at that point without continuing. Here's the code:

    Please Login or Register  to view this content.
    We tried calling a sub routine from the cancel button back in the main system module that just contained "END" but that didn't work either.

    Here's our cancel button code:

    Please Login or Register  to view this content.
    Any ideas on how to just flat out end all code from the form?

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Stop procedure completely without error

    Could it be that End in your code is never executed?
    If posting code please use code tags, see here.

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Stop procedure completely without error

    Hi tblaske

    This MIGHT work for you...can't test it...

    In your General Module
    Please Login or Register  to view this content.
    In your UserForm Module
    Please Login or Register  to view this content.
    Post a workbook and we can help you debug.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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