Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stopping a sub procedure

Status
Not open for further replies.

fedum

Technical User
Mar 22, 2004
104
BE
I have a event procedure from where I call another procedure. Now I would like to stop the running of these procedures. If I use exit sub then the second procedure will return to the first and the instructions in the first will still be executeted. I would like to stop the vba code.
 
Use a Function instead of a Sub and test its return value.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
make the second a function that returns some value if it exits

public sub procedure1()
...
'the below "if" is does the same as calling a sub.
if procedure2 then
exit sub
end if
end sub

public function procedure2() as boolean
....
if something then
procedure2 = true
exit sub
end if
exit function

 
Sorry, did not mean to be repetititve. I was saying the same as PHV, but he beat me to the submit post button while I was typing.
 
Thanks PHV and MajP. You helpt me with my problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top