Dear all ,
I have written the following program which is used to calculate the number of components and their names in an assembly file (solidworks, 3d modelling). But the array used in this program does not give values in ascending order. How to get a array values in ascending order.

For ex : a list box contains "n" No. of valuse, I need to extract all the values in ascending order, as it is listed in the list box.

How to get a array values in ascending order. ?

Regards
rajamaniThiruvengadam

Sub main()
Dim swApp As Object
Dim SWConfig As SldWorks.Configuration
Dim SWRootComp As SldWorks.component
Dim Children As Variant
Dim SWChild As SldWorks.component
Dim ChildCount As Integer
Dim bOldSetting As Boolean
Dim bRet As Boolean
Dim SWModel As SldWorks.ModelDoc2

Set swApp = Application.SldWorks
Set SWModel = swApp.ActiveDoc
Set SWConfig = SWModel.GetActiveConfiguration
Set SWRootComp = SWConfig.GetRootComponent
Children = SWRootComp.GetChildren
ChildCount = UBound(Children)
'Debug.Print SWRootComp.Name
Debug.Print ChildCount
For i = 0 To ChildCount
Set SWChild = Children(i)

'SwCmp1InsNam = swChild.Name2
'SwCmp1InsNam1 = swChild.Name2
Debug.Print i
Debug.Print SWChild.Name
Next i
End Sub

=======================
Actual order

Sub_Assy_1-1
Sub_Assy_2-3
Sub_Assy_3-4
Wrong_Planes_1-3
Wrong_Planes_2-3
=======================

Result I am getting is

0
Sub_Assy_2-3
1
Sub_Assy_3-4
2
Wrong_Planes_1-3
3
Sub_Assy_1-1
4
Wrong_Planes_2-3