using call function and exit sub together

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • seanvdv
    New Member
    • Jul 2007
    • 1

    using call function and exit sub together

    Hi everyone, any and all help on this would be appriciated as my eyes have gone squint now!
    I used to have one module(module1) , a very long one and where I had

    If File.exists(pat h) then bla bla
    else
    exit sub
    end if

    This worked great as if the file did not exit it would simply exit the program(module1 ).

    Then I thought I'd get clever and start doing calls for more manageable code.

    So in the main module(module1) I have:
    bla bla
    Call FileImport
    bla bla

    In module FileImport I have:
    If File.exists(pat h) then bla bla
    else
    exit sub
    end if

    but now the exit sub will only exit the File Import sub but I want it to exit the Main sub(module1)

    Does anyone know how to do this? I'm sure its something really simple but I cant even seem to find it on google.

    Anyone?

    Thanks a mil
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    As a general technique, simply return a value which the caller can use to decide how to proceed.

    Comment

    Working...