Error Handling - multiple possible? (1 Viewer)

Number11

Member
Local time
Today, 17:37
Joined
Jan 29, 2020
Messages
607
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, 09:37
Joined
Mar 14, 2017
Messages
8,777
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