The easiest way to handle this is to use the Try() function.
It allows you to return a value if the statement(s) within the Try() function have an error. You can then detect the error and handle it the way it needs to be handled.
See the Try() function in the Scripting Index for definition and example
Jim