Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks, I knew it would be simple, I was thinking I had to put something
after end. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
week ending | Excel Worksheet Functions | |||
Week ending | Excel Worksheet Functions | |||
Ending zero | Excel Discussion (Misc queries) | |||
ending subs | Excel Programming | |||
Ending Sub | Excel Programming |