CitectVBA Programming Reference > Understanding CitectVBA Language Basics > Control Structures > OnError statement

OnError statement

CitectVBA's error-handling routine and specifies the line label of the error-handling routine. The line parameter refers to a label. That label needs to be present in the code or an error is generated.

Syntax

On Error { GoTo line | Resume Next | GoTo 0 }

Example

On Error GoTo errHandler
Dim x as object
x.draw ' Object not set
..
Exit Sub
errHandler:
Print Err.Number, Err.Description
Resume Next

See Also

Control Structures

Published June 2018