Exit All Sub Command?

J

jutlaux

I have a sub routine called "Main" that calls routine "FindIt". Within
"Findit" I have some I am looking for arouse things. If I don't find it I
want to exit out not just "Findit", but also "Main". Is there an simple way
(one command) to do this besides setting a flag in "Findit" and checking it
in "Main"?
 
J

Jim Cone

You could change FindIt to a function and read the return
value from the function.
The other much less desirable method is to place the single
word "End" in your code when you want to shut everything down.
Be sure to read the help file on the End statement before using it.
'---
Sub Main()
'do stuff
If FindIt() Then Exit Sub
'do more stuff
End Sub
'---
Function FindIt() As Boolean
Dim strWord As String
'do stuff
FindIt = Len(strWord) = 0
End Function
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"jutlaux" <[email protected]>
wrote in message
I have a sub routine called "Main" that calls routine "FindIt". Within
"Findit" I have some I am looking for arouse things. If I don't find it I
want to exit out not just "Findit", but also "Main". Is there an simple way
(one command) to do this besides setting a flag in "Findit" and checking it
in "Main"?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top