Post Reply 
How do I raise a user-defined error?
04-21-2017, 02:05 PM (This post was last modified: 04-21-2017 02:07 PM by Han.)
Post: #3
RE: How do I raise a user-defined error?
In what sense do you mean "raise a user-defined error"? Do you already know that an error occurred at that point? If so, then a simple message box with the error string might do the job. On the other hand, if you want to generate an actual error, then your idea is likely the only way to generate an error in a controlled way. The error number is stored in Ans, but it will be useless if you forced a divide-by-0 error. You could, however, have your own errn and errmsg variable that you can set. Since you are forcing an error, then save your error number or string to an appropriate variable, generate the error, and use your variable for the error handling. It could be something as simple as return(errmsg) if you want the program to stop execution.

EDIT: It seems to me that you're eventual use of IFERR THEN END is merely to create a controlled break. Why not simply use an appropriate return()?

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: How do I raise a user-defined error? - Han - 04-21-2017 02:05 PM



User(s) browsing this thread: 1 Guest(s)