Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Stop Execution

Sub Main
Dim int As Integer
int = myFunction
End Sub

Function myFunction
Dim i As Integer
i = InputBox
If i9 then Exit Sub 'I want to stop execution of SubMain too!
myFunction = i
End Function

If i9 I want to not only Exit Sub for myFunction but stop SubMain too. How
do I do that?

Thanks,
Art
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Stop Execution

If i9 then End

The End command stops all macro processing.

Mike F
"ArthurJ" wrote in message
...
Sub Main
Dim int As Integer
int = myFunction
End Sub

Function myFunction
Dim i As Integer
i = InputBox
If i9 then Exit Sub 'I want to stop execution of SubMain too!
myFunction = i
End Function

If i9 I want to not only Exit Sub for myFunction but stop SubMain too.
How
do I do that?

Thanks,
Art



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Stop Execution

Hi Art,

Just pass something back to your calling sub from the called routine,
informing you to stop SubMain. This could be by sending a ByRef arg to the
called function, but in your example you could do this.

Sub Main
Dim int As Integer
int = myFunction
If int 9 then Exit Sub
'do more stuff
End Sub

Function myFunction
Dim i As Integer
i = InputBox
myFunction = i

if i 9 then Exit Function

' do more stuff

End Function

Never use the "End" statement to stop all code running.

Regards,
Peter T


"ArthurJ" wrote in message
...
Sub Main
Dim int As Integer
int = myFunction
End Sub

Function myFunction
Dim i As Integer
i = InputBox
If i9 then Exit Sub 'I want to stop execution of SubMain too!
myFunction = i
End Function

If i9 I want to not only Exit Sub for myFunction but stop SubMain too.

How
do I do that?

Thanks,
Art



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
Why does code execution stop? HELP! Damian Excel Programming 2 February 16th 05 06:41 PM
Stop execution of ThisWorkBook Code Anirban Excel Programming 1 November 20th 04 12:54 AM
stop execution al Excel Programming 3 October 2nd 04 01:20 AM
stop code execution with button Al ramirez Excel Programming 0 October 1st 04 06:27 AM
stop code execution al ramirez Excel Programming 1 August 26th 04 03:45 AM


All times are GMT +1. The time now is 02:26 PM.

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"