ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Listing of error codes (https://www.excelbanter.com/excel-programming/366812-listing-error-codes.html)

Rookie_User

Listing of error codes
 
Does anyone have a function or some code that contains the most common errors
so that when we create new macro's we can use a function or something when an
error happens it pulls up the correct description of the error? I am not
very good at this so if you have any other idea's please let me know.

Tim Williams

Listing of error codes
 
You can use err.Description to get a (short) text version of the error.

Tim

"Rookie_User" wrote in message ...
Does anyone have a function or some code that contains the most common errors
so that when we create new macro's we can use a function or something when an
error happens it pulls up the correct description of the error? I am not
very good at this so if you have any other idea's please let me know.




NickHK

Listing of error codes
 
The Err object has a variety of properties, .Number, .Description, .Source
etc. that you read in an error trap:
On Error Goto Handle
'Code
Exit Function/sub
Handler:
With Err.
Msgbox Number & vbNewLine & .description & vbnewline & .source
'Raise your own error
.Raise vbObjectError + 513, "ThisFunction","Invalid something"
End With

NickHK

"Rookie_User" wrote in message
...
Does anyone have a function or some code that contains the most common

errors
so that when we create new macro's we can use a function or something when

an
error happens it pulls up the correct description of the error? I am not
very good at this so if you have any other idea's please let me know.





All times are GMT +1. The time now is 06:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com