Is it possible instead of having an message box here is it possible to call a logfile??
ThanksCode:On Error GoTo NOFSO
'stuff
NOFSO:
MsgBox "FSO CreateObject Failed, Copying of files"
end sub
JK
Printable View
Is it possible instead of having an message box here is it possible to call a logfile??
ThanksCode:On Error GoTo NOFSO
'stuff
NOFSO:
MsgBox "FSO CreateObject Failed, Copying of files"
end sub
JK
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
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