Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 -- ALittle ------------------------------------------------------------------------ ALittle's Profile: http://www.excelforum.com/member.php...o&userid=28695 View this thread: http://www.excelforum.com/showthread...hreadid=487484 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello Alittle, Could you provide a better code example of what you are trying to accomplish? Thanks, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=487484 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Actually, no. I cannot provide code. That’s what I am looking for. I want to do the equivalent of Set obj = new classname However, the name of any actual class (e.g., classname) is not know during programming, so the above statement cannot be hard coded. It i only during program execution that actual class names are known. This may not be possible except through slight of hand, which I woul like to avoid. Possible solutions that I might be forced to try would include: -- using some type of immediate execution code to execute a characte string statement or -- writing code to a class module and then executing that code -- ALittl ----------------------------------------------------------------------- ALittle's Profile: http://www.excelforum.com/member.php...fo&userid=2869 View this thread: http://www.excelforum.com/showthread.php?threadid=48748 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
hard coding a cell | Excel Discussion (Misc queries) | |||
User-changeable paths into Excel - avoid hard coding | Excel Programming | |||
Hidding Macro names and coding | Excel Discussion (Misc queries) | |||
Instantiate a Class via Automation | Excel Programming | |||
Hard-Coding a File Location | Excel Programming |