Connecting Tech Pros Worldwide Help | Site Map

How to Exit Sub on Error?

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 06:09 PM
deko
Guest
 
Posts: n/a
Default 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?




  #2  
Old November 12th, 2005, 06:10 PM
Steve Jorgensen
Guest
 
Posts: n/a
Default Re: How to Exit Sub on Error?

On Fri, 16 Jan 2004 00:34:25 GMT, "deko" <dje422@hotmail.com> wrote:
[color=blue]
>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?
>
>[/color]

Yup. That's not so bad, though, is it?
  #3  
Old November 12th, 2005, 06:10 PM
fredg@example.invalid
Guest
 
Posts: n/a
Default Re: How to Exit Sub on Error?

On Fri, 16 Jan 2004 00:34:25 GMT, "deko" <dje422@hotmail.com> wrote:
[color=blue]
>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?
>
>[/color]
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.
  #4  
Old November 12th, 2005, 06:10 PM
deko
Guest
 
Posts: n/a
Default Re: How to Exit Sub on Error?

no.... was just curious if there was a better way...

thanks for the reply

"Steve Jorgensen" <nospam@nospam.nospam> wrote in message
news:usce00tumbkqbgpk8did27nib8o8k1ekdb@4ax.com...[color=blue]
> On Fri, 16 Jan 2004 00:34:25 GMT, "deko" <dje422@hotmail.com> wrote:
>[color=green]
> >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?
> >
> >[/color]
>
> Yup. That's not so bad, though, is it?[/color]


  #5  
Old November 12th, 2005, 06:10 PM
xzzy
Guest
 
Posts: n/a
Default Re: How to Exit Sub on Error?

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" <dje422@hotmail.com> wrote in message
news:lkGNb.11466$mh1.9805@newssvr27.news.prodigy.c om...[color=blue]
> 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?
>
>
>[/color]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.