Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Download MSE2
#17
DFA Wrote:On Error Resume Next is the only solution for that specific problem

If "On Error Resume Next" burns your eyes, try...

Code:
Public Sub Name()
On Error Goto ErrorHandle1

Exit Sub
ErrorHandle1:

End Sub

And a good thing to put in the ErrHandle1 label section is something like:

Code:
If Err.Number > 0 Then
    AddLog "Error: " & Err.Number & "; While running Sub Name(" & Variable1 & ", " & Variable2 & ") at " & whatever function for time & ".", "errorlist.txt"
End If

That's still not good error handling...what would be even better is to do error trapping like vbGORE does with On Error GoTo 0 or however it does it...and also to display the sub name with the variables that are in it.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)