#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default ending vba

I am sure this is super simple but cannot find it anywhere.

I am running subs that call on a list of other subs, I want to test
something and stop vba from running. So far it just exits the sub I am in and
continues to run the next sub. How do I shut down VBA completly and take user
back to the Excel Spreadsheet?

If PName = "" Then
x = MsgBox("You must enter a Participant Name", vbCritical, "Error")
Application.Goto Sheets("Program Controls").Range("ParticipantName"),
True
'Here I want to stop running ALL VBA code not just this subroutine
End If

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default ending vba

You could use

End

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Arnold Klapheck" wrote in
message ...
I am sure this is super simple but cannot find it anywhere.

I am running subs that call on a list of other subs, I want to test
something and stop vba from running. So far it just exits the sub I am in

and
continues to run the next sub. How do I shut down VBA completly and take

user
back to the Excel Spreadsheet?

If PName = "" Then
x = MsgBox("You must enter a Participant Name", vbCritical, "Error")
Application.Goto Sheets("Program

Controls").Range("ParticipantName"),
True
'Here I want to stop running ALL VBA code not just this subroutine
End If



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default ending vba

You could change your subs into functions that return booleans. Something
like this...

sub DoLotsOfStuff
if DoThis = false then exit sub
if DoThat = false then exit sub
msgbox "Everything went ok"
end sub

Function DoThis() as boolean
DoThis = True
if False then
DoThis = False
exit function
end if
End Function

Function DoThat() as boolean
DoThat= True
if true then
DoThat= False
exit function
end if
End Function
--
HTH...

Jim Thomlinson


"Arnold Klapheck" wrote:

I am sure this is super simple but cannot find it anywhere.

I am running subs that call on a list of other subs, I want to test
something and stop vba from running. So far it just exits the sub I am in and
continues to run the next sub. How do I shut down VBA completly and take user
back to the Excel Spreadsheet?

If PName = "" Then
x = MsgBox("You must enter a Participant Name", vbCritical, "Error")
Application.Goto Sheets("Program Controls").Range("ParticipantName"),
True
'Here I want to stop running ALL VBA code not just this subroutine
End If

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default ending vba

You should note that End clears any global variables and objects... This may
or may not be an issue.
--
HTH...

Jim Thomlinson


"Bob Phillips" wrote:

You could use

End

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Arnold Klapheck" wrote in
message ...
I am sure this is super simple but cannot find it anywhere.

I am running subs that call on a list of other subs, I want to test
something and stop vba from running. So far it just exits the sub I am in

and
continues to run the next sub. How do I shut down VBA completly and take

user
back to the Excel Spreadsheet?

If PName = "" Then
x = MsgBox("You must enter a Participant Name", vbCritical, "Error")
Application.Goto Sheets("Program

Controls").Range("ParticipantName"),
True
'Here I want to stop running ALL VBA code not just this subroutine
End If




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default ending vba

thanks, I knew it would be simple, I was thinking I had to put something
after end.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
week ending peter Excel Worksheet Functions 4 April 3rd 08 03:31 AM
Week ending [email protected] Excel Worksheet Functions 3 November 1st 05 04:52 PM
Ending zero RAB Excel Discussion (Misc queries) 3 August 25th 05 06:09 PM
ending subs [email protected] Excel Programming 2 May 17th 05 06:13 PM
Ending Sub Paul Excel Programming 3 October 1st 04 07:48 PM


All times are GMT +1. The time now is 05:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"