'This script prompts the user to load each unloaded controlled unit in the model

Sub Main
 Dim units As New ControllableUnitCollection
 Dim unit As ControllableUnit
 Dim cats As CategoryCollection
 Dim cat As Category

 Set cats = RoseApp.CurrentModel.GetAllCategories()

 For i% = 1 To cats.Count
  Set cat = cats.GetAt(i%)
  If Not cat.IsLoaded() And Not cat.TopLevel() Then
   units.Add cat
  End If
 Next i%

 For j% = 1 To units.Count
  Set unit = units.GetAt(j%)
  prompt$ = "Load unit " & unit.name & "?"
  If AnswerBox(prompt$, "Load", "Don't Load") = 1  Then
   worked = unit.Load()
  End If
 Next j%
End Sub