472,131 Members | 1,353 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,131 software developers and data experts.

How to Exit Sub on Error?

Is there a shorthand way to Exit Sub On Error?

This does not seem to work:

On Error Exit Sub

And I don't want to use: On Error GoTo 0

Must I use: GoTo Exit_Here?

Nov 12 '05 #1
4 44320
On Fri, 16 Jan 2004 00:34:25 GMT, "deko" <dj****@hotmail.com> wrote:
Is there a shorthand way to Exit Sub On Error?

This does not seem to work:

On Error Exit Sub

And I don't want to use: On Error GoTo 0

Must I use: GoTo Exit_Here?


Yup. That's not so bad, though, is it?
Nov 12 '05 #2
On Fri, 16 Jan 2004 00:34:25 GMT, "deko" <dj****@hotmail.com> wrote:
Is there a shorthand way to Exit Sub On Error?

This does not seem to work:

On Error Exit Sub

And I don't want to use: On Error GoTo 0

Must I use: GoTo Exit_Here?

Sub Something()
On Error GoTo Err_Handler
' Do your stuff here
Exit_This_Sub:
Exit Sub
Err_Handler:
Resume Exit_This_Sub
End Sub
--
Fred

Please reply only to this newsgroup.
I do not reply to personal e-mail.
Nov 12 '05 #3
no.... was just curious if there was a better way...

thanks for the reply

"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:us********************************@4ax.com...
On Fri, 16 Jan 2004 00:34:25 GMT, "deko" <dj****@hotmail.com> wrote:
Is there a shorthand way to Exit Sub On Error?

This does not seem to work:

On Error Exit Sub

And I don't want to use: On Error GoTo 0

Must I use: GoTo Exit_Here?


Yup. That's not so bad, though, is it?

Nov 12 '05 #4
try something like:

Function F_VAL_MyScreen(MyForm As Form) As Boolean
On Error GoTo F_VAL_MyScreen_Err:
F_VAL_MyScreen = False

blah, blah, blah

F_VAL_MyScreen = True
F_VAL_MyScreen_EXIT:
Exit Function

F_VAL_MyScreen_Err:
If Err.Number <> 0 Then
Call F_WL("E", -1, Err, MyForm.Name, "F_VAL_MyScreen", "", "", "",
"", Err.Number & " - " & Err.Description)
Resume F_VAL_MyScreen_EXIT:
Else
GoTo F_VAL_MyScreen_EXIT:
End If

End Function

John Bickmore
www.BicycleCam.com
www.Feed-Zone.com

"deko" <dj****@hotmail.com> wrote in message
news:lk******************@newssvr27.news.prodigy.c om...
Is there a shorthand way to Exit Sub On Error?

This does not seem to work:

On Error Exit Sub

And I don't want to use: On Error GoTo 0

Must I use: GoTo Exit_Here?

Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Dan | last post: by
3 posts views Thread by Smriti Dev | last post: by
3 posts views Thread by Mike Johnson | last post: by
3 posts views Thread by GinTon | last post: by
3 posts views Thread by faz | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.