Traverse cut list in order displayed in feature tree

I'm using a macro to pre-process my cut lists to add custom properties I want shown in the drawing. I also manually drag/drop cut list folders in the part's feature tree to set the order in which I want cut list items to appear. What I would like is to add a custom property to each cut list folder called Item Number, whose value is 1 for the first item in the cut list and increments for each successive item.

The problem is that the macro I have to process my cut list does not traverse the cut list in the order I have set, so for example the second cut list folder the macro encounters is actually the 8th item in my list.

This is the code I use to traverse the feature tree and set cut list properties:

Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2

Dim swFeat As SldWorks.Feature

Dim var As Variant
Dim swFeatMgr As SldWorks.FeatureManager

Sub main()

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swFeatMgr = swModel.FeatureManager

ItemNo = 1

var = swFeatMgr.GetFeatures(False)

For i = 0 To UBound(var)

Set swFeat = var(i)

If swFeat.GetTypeName2 = "CutListFolder" Then 'Feature is a cut list item

'process cut list folder

swFeat.CustomPropertyManager.Add3 "ITEM NUMBER", swCustomInfoText, ItemNo, swCustomPropertyDeleteAndAdd

ItemNo = ItemNo + 1

End If

Next

End Sub

Evidently the way the cut list folder "features" are ordered within the swModel.FeatureManager object does not necessarily correspond to the order of the cut list folders displayed in the Feature Tree when folders have been manually rearranged.

Does anybody know a way I can get the order of cut list items as displayed in the Feature Tree from the API?

Thanks!

SolidworksApi/macros