Find whether a method exists for an object

littlehogarth used Ask the Experts™
I have an application that allows for vbscript and jscript macros. The application has new methods added in newer versions that give better functionality, but I want to maintain backward compatibility. Is there a way to check if an object has a specific property or method?

If I try and use a property that doesn't exist I get error:
"Object doesn't support this property or method: 'object.method'"

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You can use:

On error resume next

To ignore the error and proceed.


Thanks for answering so quickly. That is too easy. I had thought about that, but wasn't sure if that was bad practice to use an error to check if something exists. Guess it is the vbscript way.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial