The AddNew method of a Decision Support Objects (DSO) collection creates and adds an object to a collection.
colCollection.AddNew(Name, [SubClassType])
The ClassType property of the new object is set automatically and depends on the parent of the collection to which the object is being added. For example, objects added to the MDStores collection of an object of ClassType clsDatabase automatically receive a ClassType value of clsCube.
The AddNew method maintains hierarchical relationships and ordering within the collection.
Note The AddNew method should be used when adding new objects to a collection. The Add method is recommended for use only when adding existing objects to a collection, such as when adding aggregations to a partition after you have designed aggregations. For more information, see clsPartitionAnalyzer.
Use the following code to create a new cube and add it to the MDStores collection of cubes:
' Assume the existence of an object objDB
' of ClassType clsDatabase
Dim objNewCube As MDStore
Set objNewCube = objDB.MDStores.AddNew("NewCube")