Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trapping Errors

Status
Not open for further replies.

jet4135

Programmer
Oct 25, 2001
6
FR
Does anybody know How I could trap an error returned in my VB script ?

For instance, an error from the file winerror.h (like 0x80020010), in order to substitute my own message to the usual one ?


Thanks.
 
Try using the "err" object. If you know the error number that you want to change the message for, the simplest way of changing the message would be something like (assuming the error number is 68):

select case err.number
case 68
msgbox "You have created an error. It is because: " & err.description
end select

The err.number will return the actual error number, while err.description returns a string description of the error. Hope this helps.
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."

-Hitch Hiker's Guide To The Galaxy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top