Results 1 to 2 of 2

Thread: Smart Error Handling- Need help..

  1. #1

    Thread Starter
    Frenzied Member mxnmx's Avatar
    Join Date
    Dec 2001
    Location
    I'm back...now!!!
    Posts
    1,396

    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!!!
    Can't Remember Birthdays or Important Dates- Never Miss any Important Date(s)

  2. #2
    Fanatic Member Armbruster's Avatar
    Join Date
    Sep 2002
    Location
    Maryland Heights, MO
    Posts
    857
    VB Code:
    1. Option Explicit
    2.  
    3.  
    4. Sub Something()
    5. On Error GoTo errhandler
    6.     'some code with an error
    7.  
    8. Exit Sub
    9. errhandler:
    10.     LogEvent Now, Err.Number, Err.Description, Err.Source
    11. End Sub
    12.  
    13. Public Sub LogEvent(myTime As Date, myError As Long, myErrorString As String, myErrorSource As String)
    14.     Dim NextFreeFile As Long
    15.     NextFreeFile = FreeFile
    16.     Open "\Error.log" For Append As #NextFreeFile
    17.         Write #NextFreeFile, myTime; myError; myErrorString, myErrorSource
    18.     Close #NextFreeFile
    19. 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
  •  



Click Here to Expand Forum to Full Width