Question:
How can I create a unit or a value set at run time?
Solution:
To do so, you must use the following Formula methods:
object.CreateUnit bstrunitName
This method creates a new unit (for example, “Unit 4“), where the object is the module (for example, “Formula1“) where the new unit will be created.
Example: Application.GetObject(“Formula1”).CreateUnit “Unit 4”
object.CreateValue bstrvalueName
This method creates a new value set (for example, “Value 5“), where the object is the module (for example, “Formula1“) where the new set will be created.
Example: Application.GetObject(“Formula1”).CreateValue “Value 5”