By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,950 Members | 1,035 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,950 IT Pros & Developers. It's quick & easy.

How to Exit Sub on Error?

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.