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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Handling

Status
Not open for further replies.

Magnet31

Technical User
Jan 22, 2003
3
AU
Apologies for newby questions...

Can I do asomething like this...

try
some operation
on error
do something
end

If yes, can someone help me with the commands and syntax.

Many thanks.
 
in VBS, the only error handling features are represented by 2 statments and one object :
Statments
Code:
On error resume next
: Start error handling
Code:
On error goto 0
: ends error handling
Object
Code:
Err
object has these usefull properties and methods :
Code:
Number
: error number (Long)
Code:
Description
: error description (String)
Code:
Clear()
: Clears the err object.

Here's an example of how to use it
Code:
on error resume next
' put it your 'risky' command
if err.number <> 0 Then
  Msgbox err.description,, &quot;Error Number &quot; & err.Number
  err.clear
  exit sub
end if
On error goto 0
Water is not bad as long as it stays out human body ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top