Error Handling - multiple possible? (1 Viewer)

Number11

Member
Local time
Today, 22:38
Joined
Jan 29, 2020
Messages
208
so i did give up on this buts its time to create my code so whats the best way to deal with say 10 different runtime error codes each of them providing the user with the reason why and what to do to fix it

Like 2391 Contact Name is not found in the importing table - Message to say "correct spreadsheet headers"
 

Isaac

Lifelong Learner
Local time
Today, 14:38
Joined
Mar 14, 2017
Messages
2,638
include the on error line to goto your error handler label
inside the error handler, use an IF or a SELECT CASE to determine the error number or (better yet, to me), the description
display a message box

even better than trapping errors by On Error is to anticipate those errors and use validation techniques to see if they are going to occur before they do, and then take some action.
 

Users who are viewing this thread

Top Bottom