'**Patrick Rutledge, Rose Support, 8/98 'This script alphabetizes the classes in a selected packake by removing 'them from the package and relocating them in aplhabetical order Dim namesArray() As String Sub Sort (inCat As Category) Dim store As New ClassCollection Dim catClasses As ClassCollection Dim aClass As Class Dim tempCat As Category Set catClasses = inCat.Classes If catClasses.Count < 2 Then Exit Sub End If RoseApp.WriteErrorLog "Package: " & inCat.name 'make a temporary category Set tempCat = RoseApp.CurrentModel.RootCategory.AddCategory("temp") 'out the names in the array we will use to alphabetize ReDim namesArray (1 To catClasses.Count) For i = 1 To catClasses.Count namesArray(i) = catClasses.GetAt(i).name Next i 'move the classes to the temporary category While catClasses.Count > 0 Set aClass = catClasses.GetAt(1) tempCat.RelocateClass aClass Wend ArraySort namesArray 'put the classes back in their order in the name array Dim theClass As Class For m = 1 To UBound(namesArray) pos = tempCat.Classes.FindFirst(namesArray(m)) Set theClass = tempCat.Classes.GetAt(pos) inCat.RelocateClass theClass Next m 'destroy the temporary category worked = RoseApp.CurrentModel.RootCategory.DeleteCategory(tempCat) End Sub Sub Main Dim theCats As CategoryCollection Dim theModel As Model Set theModel = RoseApp.CurrentModel Set theCats = theModel.GetSelectedCategories() If theCats.Count < 1 Then MsgBox "No categories selected" Exit Sub End If RoseApp.WriteErrorLog "" RoseApp.WriteErrorLog "[Sort Classes]" For i = 1 To theCats.Count Sort theCats.GetAt(i) Next i RoseApp.WriteErrorLog "Done" MsgBox "Done: see log for details" End Sub