Set x = CreateObject("ClassX")

The latter does not need a reference to the library that contains ClassX , and the rest of the code will run even if the library is not present.

Maybe you can use this approach in your case.