Announcement Banner
UNSOLVED

Crosbylake

updated

20 years ago

C

Crosbylake

73 Posts

0

6042

December 16th, 2006 14:00

Excel VBA

When you have nested subroutines and want to exit the application is there a command that will do this. Exit Sub takes you back thru the nested hierarcy.
Thanks
  • Bay Wolf

    4438 Posts

    345

    0

    Posted December 17th, 2006 03:00

    You can just use End Sub where you want to exit is one way.
     
    The other is to use a GOTO statement. 
     
     
    Example
     
    Sub
     
         Sub
    GOTO PROC_END
         end sub
     
     
    PROC_END:   'this is where the GOTO statement will take you.  Note, there is a colon after the name.
     
    end sub
     
     

    Message Edited by Bay Wolf on 12-16-200611:06 PM

    Message Edited by Bay Wolf on 12-16-200611:06 PM

  • Bay Wolf

    4438 Posts

    345

    0

    Posted December 17th, 2006 03:00

    :smileymad:
    Double post. 
     
      

    Message Edited by Bay Wolf on 12-16-200611:04 PM

  • Crosbylake

    73 Posts

    345

    0

    Posted December 17th, 2006 14:00

    Thanks, but this is not what I am looking for. I want to terminate the VBA Excel application (from within a nested subroutine) without having to trace back thru the nested subroutines (back to the origional calling sub).
    Crosbylake