For example:
Object required: <offending object name>
In other cases, this may cause an application crash. For example, if you attempt to use an ActiveView object for a schematic sheet after the schematic sheet has been closed.
A good practice is to have the script check the validity of an object before using it. Following this practice also helps to diagnose problems with scripts because using invalid objects is a common cause of scripts not running to completion.
In this example, <object Name> is the name of an object in a script:
' Enable error-handling.
On Error Resume Next
If <object name> Is Nothing Then
MsgBox <object name> & " Object not found."
Else
MsgBox <object name> & " Object is valid."
End IfIf necessary, use the On Error GoTo 0 statement to disable error handling by the script. For example:
‘Disable error-handling
On Error GoTo 0