469,326 Members | 1,541 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,326 developers. It's quick & easy.

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 43697
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
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.