Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error on On Error routine
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
You can use the Err object in an if/case statement to handle error.

Code:
on error resume next
z = 1/0
select case err.number
   case -21345896 'please look up the correct error number
     msgbox err.description & ": you divided by zero"
   case else
      msgbox err.description
end select

I created a class to handle error and enhanced the class with a DLL written in .NET to store to eventlog, file, or database. You don't need .NET for file or database, I just prefer the eventlog and could write it easily in .NET. To use the class just replace the case statement with a sub call and pass the err object.
Reply


Messages In This Thread
Error on On Error routine - by upadhyay40 - 12-23-2009, 07:40 PM
RE: Error on On Error routine - by Saket - 12-24-2009, 10:56 AM
RE: Error on On Error routine - by jsknight1969 - 12-29-2009, 03:18 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  General run error when Exist fails msacks 1 1,650 02-08-2019, 02:12 AM
Last Post: Ankur
  Error Recovery Scenario vamshiram 6 7,033 08-04-2017, 07:27 PM
Last Post: sucheta
  "Action was not found" error. What to do? ttralor 2 5,850 05-04-2017, 03:54 PM
Last Post: Ankur
  Not getting error pop up when replaying through batch amit25007 0 1,307 02-14-2017, 04:01 PM
Last Post: amit25007
  "Continue to this website (not recommended)." Error we are getting kotaramamohana 7 28,051 07-21-2016, 09:55 PM
Last Post: Ranjith Nair

Forum Jump:


Users browsing this thread: 1 Guest(s)