>Hi,
>
>I would like to trap the error if an object is not successfully created.
>For Eg.
>owsh=CreateObject("Scriping.FilesystemObject")
>IF Vartype(oWsh)<>"O"
> =MessageBox("Not created")
>ENDIF
>In this case, if the system can not create the object, it would yell saying, 'Class definition 'Scriping.FilesystemObject' is not found'. So, even before I can check it's type, the error comes up. Do I have to use the error routine to trap the error, or is there a more direct way to check for the error here?
>
>TIA
The simplest method is using ON ERROR command.
ln_Error = 0
On error ln_Error = error()
owsh=CreateObject("Scripting.FilesystemObject")
On error
If (ln_Error != 0)
Wait 'Error = ' + transform(ln_Error)
else
endif
Herman