|
-
Oct 30th, 2002, 02:42 PM
#1
Thread Starter
Frenzied Member
Smart Error Handling- Need help..
Is there a way to log all the errors in a text file, when they occur...so that when there's a run time error- and there's on error goto ErrorHandler, then the error handler takes over. But I was reading somewhere that we can trap the errors (how they happened) and log them in a text file. How is that possible??? Any idea, anyone!!!
-
Oct 30th, 2002, 02:53 PM
#2
Fanatic Member
VB Code:
Option Explicit
Sub Something()
On Error GoTo errhandler
'some code with an error
Exit Sub
errhandler:
LogEvent Now, Err.Number, Err.Description, Err.Source
End Sub
Public Sub LogEvent(myTime As Date, myError As Long, myErrorString As String, myErrorSource As String)
Dim NextFreeFile As Long
NextFreeFile = FreeFile
Open "\Error.log" For Append As #NextFreeFile
Write #NextFreeFile, myTime; myError; myErrorString, myErrorSource
Close #NextFreeFile
End Function
something like that?
"Look! Up in the sky! It's a bird! It's a plane! It's Diaper-Head Boy! (there by my name!) Yes, Diaper-Head Boy, who disguised as my son, Seth, fights a never-ending battle for truth, justice and terrorizing my house!
Resistance is futile, you will be compiled . . . Please!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|