How to Create an Error Log file
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 'Error Handling - How to Create an Error Log file Public Sub errLogger(ByVal lNum As Long, ByVal sDesc As String, ByVal sFrom As String) Dim FileNum As Integer FileNum = FreeFile Open App.Path & "\Errors.log" For Append As FileNum Write #FileNum, lNum, sDesc, sFrom, Now() Close FileNum End Sub Private Sub Command1_Click() On Error GoTo Err_handler Command1.Picture = LoadPicture("Test") Exit Sub Err_handler: If Err.Number <> 0 Then Call errLogger(Err.Number, Err.Description, "Command1_Click") Err.Clear Resume Next End If End Sub |