PC Review


Reply
Thread Tools Rate Thread

Can I end a sub on error?

 
 
=?Utf-8?B?QWFyb24=?=
Guest
Posts: n/a
 
      17th Aug 2007
I need some code so that if the sub errors anywhere the sub simply ends
instead of giving the user the "Debug or End" message box. Please help.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      17th Aug 2007
You can use On Error Goto something like this...

Sub WhatEver()
On Error GoTo ExitSub
'Your Code

ExitSub:

End Sub
--
HTH...

Jim Thomlinson


"Aaron" wrote:

> I need some code so that if the sub errors anywhere the sub simply ends
> instead of giving the user the "Debug or End" message box. Please help.

 
Reply With Quote
 
JE McGimpsey
Guest
Posts: n/a
 
      17th Aug 2007
One way:

Public Sub AbortOnError()
On Error GoTo ErrHandler

'Your code here

Exit Sub
ErrHandler:
'Handle Error, Clean up, or just exit
End Sub

In article <89ADC008-1A7B-4BD3-ACDF-(E-Mail Removed)>,
Aaron <(E-Mail Removed)> wrote:

> I need some code so that if the sub errors anywhere the sub simply ends
> instead of giving the user the "Debug or End" message box. Please help.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Server Error: 451, Socket Error: 10053, Error Number: 0x800CCC0F =?Utf-8?B?RGFuaWVsYQ==?= Windows XP Help 3 17th Aug 2007 05:10 PM
Access error 3197 and JETCOMP.exe error "Error compacting database =?Utf-8?B?Vmlja3k=?= Microsoft Access 2 21st Jul 2007 12:29 AM
Error connecting to SQLExpress 2005 locally (error: 26 - Error Locating Server/Instance Specified) hfk0 Microsoft ASP .NET 2 27th Mar 2006 09:43 PM
3 Problems - Media Center Error, Date/Time Error, Downloading Updates Error angieangie Windows XP General 0 23rd Dec 2005 06:33 PM
A runtime error has occured. Do you want to debug? Line: 1 Error: syntax error Eric Windows XP Networking 0 24th Nov 2003 03:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:09 PM.