ERROR - Statement

ERROR[(errornumber)]

(Err.Raise) Generates an error.


errornumber(Optional) The error number you want to generate (Integer).

REMARKS
* You cannot prefix this statement with "VBA."
* Err.Raise was added to replace this statement.
* You can use the CVERR function to return a specific type of error.
* You can use the ERROR Function to return the error message corresponding to a given error number.
* You can use the ISERROR function to return True or False depending if an expression is an error.
* For the Microsoft documentation refer to learn.microsoft.com

Error 6  'generates Overflow  
Error 11 'generates Division by zero
Error 55 'generates File already open

Call Error(6) 'does not work !!

On Error GoTo ErrorHandler
   Error 55
   Exit Sub
ErrorHandler:
   MsgBox(Err.Number & " - " & Err.Description)

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top