dimanche 14 janvier 2018

Exit VBA Main Subroutine from Called Subroutine

I have a sub "main" which calls sub "prepare" as well as other subroutines. I have an if statement in "prepare" that exits the sub if a condition is met. However, it only exits that specific subroutine and then goes on to execute all of the other subroutines in "main".

    If oAltIDLocationDictionary.Exists(sAltID) Then
        MsgBox "It appears that there are two duplicate ID's in your alternate ID list.  Duplicate ID's cannot be processed, please consolidate the location information into a single ID or remove the duplicate ID from the Alt-ID list."
        Exit Sub
    End If

Is there a way to exit the "main" from the "prepare" sub it's calling so that when the condition is met in the "prepare" sub the "main" sub stops and no further code is executed?

Aucun commentaire:

Enregistrer un commentaire