Results 1 to 3 of 3

Thread: Error Handling

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Ireland
    Posts
    224

    Question

    Is it possible instead of having an message box here is it possible to call a logfile??
    Code:
    On Error GoTo NOFSO
    'stuff
    
    NOFSO:
        MsgBox "FSO CreateObject Failed, Copying of files"
    end sub
    Thanks
    JK

  2. #2
    Guest
    Sure, here is an example:

    Code:
        On Error GoTo ErrTrap
        Err.Raise 5
    
    ErrTrap:
        Dim iFileNummer As Integer
        iFileNummer = FreeFile
        Open App.Path & "\Error.log" For Append As iFileNummer
        Print #iFileNummer, "Error: " & Now
        Print #iFileNummer, "Number: " & Err.Number
        Print #iFileNummer, "Desc: " & Err.Description
        Close #iFileNummer

  3. #3
    New Member
    Join Date
    Sep 2000
    Posts
    5
    I'm not sure if what you want to do is output a message to a file, but if it is you can do it like this. You'll still need an alert to the user that the process has failed.

    Dim outfile as Integer
    Dim apppath as String

    On Error GoTo NOFSO

    'stuff

    NOFSO:
    outfile = FreeFile

    Open apppath$ & "\Failure.log" For Append As #outfile
    Print #outfile, FSO CreateObject Failed, Copying of files
    Close #outfile

    End Sub

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