Exit sub

  • Thread starter Thread starter simon
  • Start date Start date
S

simon

I have sub and from tis sub I call another sub.
If some condition is true then I would like to exit all subs not only the current one, which I can do with exit sub

How can you do that?

Private Sub UpdateAdv()
call UpdateFinal
.....
.....
end sub

Private Sub UpdateFinal()
....
IF condition=true then
exit all sub
end if
....
end sub

Thank you,

Simon
 
Simon,

Maybe I understand your question wrong, however in a single thread
application a program is always only active in one Sub, so what are you
searching for.

Cor
 
Hello,

You'd be better off changing it to a function, as follows:-

Private Sub UpdateAdv()

If Not UpdateFinal() Then
Exit Sub
End If

...

End Sub

Private Function UpdateFinal() As Boolean

...
If Condition = True Then
Return True
EndIf
Return False

End Function

Hope this helps.
Regards
Simon Jefferies
mailto:simon[nospam]@cooltoolsonline.co.uk
-- remove [nospam] to email me --


I have sub and from tis sub I call another sub.
If some condition is true then I would like to exit all subs not only the current one, which I can do with exit sub

How can you do that?

Private Sub UpdateAdv()
call UpdateFinal
.....
.....
end sub

Private Sub UpdateFinal()
....
IF condition=true then
exit all sub
end if
....
end sub

Thank you,

Simon
 
Thank you.
That is what I want.

I tried with exit word but it doesn't work for classes.

Simon
Hello,

You'd be better off changing it to a function, as follows:-

Private Sub UpdateAdv()

If Not UpdateFinal() Then
Exit Sub
End If

...

End Sub

Private Function UpdateFinal() As Boolean

...
If Condition = True Then
Return True
EndIf
Return False

End Function

Hope this helps.
Regards
Simon Jefferies
mailto:simon[nospam]@cooltoolsonline.co.uk
-- remove [nospam] to email me --


I have sub and from tis sub I call another sub.
If some condition is true then I would like to exit all subs not only the current one, which I can do with exit sub

How can you do that?

Private Sub UpdateAdv()
call UpdateFinal
.....
.....
end sub

Private Sub UpdateFinal()
....
IF condition=true then
exit all sub
end if
....
end sub

Thank you,

Simon
 

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

Back
Top