I would like to instantiate classes, which I have written in Excel VBA, without hard-coding class names..
For example, the following code could set obj to a particular CodeModule.
Set obj = thisWorkbook.VBProject.VBComponents(indx)
But I really need to instantiate the class that the module represents. I.e.,
Set obj = new classname
, where classname is thisWorkbook.VBProject.VBComponents(indx).Name.
Any ideas? (If I could accomplish this, it would allow the application to query all classes in the Class Modules and choose appropriate classes to process. Hard-coding requires additional redundant code every time new classes are added.)
Thanks
Bookmarks