Creating Structure Datatypes and assign variables to a specific one

Creating Structure Datatypes and assign variables to a specific one

Hello,
I want to create a structure datatype with VBA (this could also be done manually if the VBA solution is to complex).
The following part is more important for me.
As next step i want to search all variables for a certain string pattern, if i find one it should be put under the appropiate structure variable.
Example:
Structure:
+ engine
¦-- torque
¦-- power
¦-- engine displacement

Example Variablelist:
-somevar1
-somevar2
-myengine.power
-otherengine.power
-myengine.engine_displacement
-somevar3
-myengine.torque
If my algorithm is invoked with a search parameter "myengine". Now the "flat variables" are put into the structure described above.
Resulting structre:
+ myengine
¦-- myengine.torque
¦-- myengine.power
¦-- myengine.engine_displacement

I think is it not possible with vba api to put an existing non-structure variable under a structure.
Perhaps when i find a result i can create a new empty structre (if it not exists already). Then copy all values (name, limits, etc.) of the result variable to the corresponding part in the structure and delete the flat variable after copying all attributes.
But i have no idea what i have to copy to create a new variable with exactly the same attributes.
Please help me with my problem, i thank you in advance.

This is a migrated post! Originally posted on 23.03.2009 by user mastr. Please be aware that information can be outdated.