Posts: 43
Threads: 13
Joined: Nov 2002
I have seen the code for this somewhere, but I cannot remember where.
When I am in a sub, and I would like to go to the main module, what code would I use?
Thanks.
Posts: 729
Threads: 105
Joined: Feb 2003
Look up EXIT SUB in the help file.
size=9]"To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public." -- Theodore Roosevelt[/size]
Posts: 43
Threads: 13
Joined: Nov 2002
I tried EXIT SUB, but that did not take me back to the main module. It just ends the program.
Posts: 704
Threads: 0
Joined: Dec 2002
EXIT SUB and END SUB return program execution to the routine that called the subroutine. If that routine is MAIN, then that's how you get back to MAIN. Otherwise, you have to exit all levels of subroutines/functions before getting back to MAIN. In the program that EXIT SUB caused to terminate, was there anything in the program after the call to the subroutine?
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Posts: 43
Threads: 13
Joined: Nov 2002
Quote:In the program that EXIT SUB caused to terminate, was there anything in the program after the call to the subroutine?
No, I don't believe so.
Posts: 306
Threads: 14
Joined: Nov 2002
Then that would be why exiting the sub just ended the program. :wink: Try putting just some random code after the call and it should perform it before ending the program when you exit the sub.