Dim theExternalDocs As ExternalDocumentCollection Dim theExternalDocument As ExternalDocument Dim selectedIndex As Integer Const crlf = Chr$(13) + Chr$(10) Dim isOpen As Boolean Function selectListDocuments(ControlName$, Action%, SuppValue%) ' initailise Dialog If Action% = 1 Then ' DlgEnable "TextBox1", 0 End If ' When the OK button is pressed, update the selectedIndex to point to the correct namespace array If Action% = 2 And ControlName$ = "OK" Then s% = DlgValue("thedocumentlist") selectedIndex = s% + 1 Set theExternalDocument = theExternalDocs.GetAt(selectedIndex) isOpen = theExternalDocument.Open("") ' Close the Dialog selectListDocuments = 1 End If If Action% = 2 And ControlName$ <> "OK" Then selectedIndex = 0 selectListDocuments = 0 End If End Function Sub Main Dim documentlist() As String Begin Dialog ListDocuments ,,324,164,"Resolve Namespace",.selectListDocuments,,1 OKButton 177,136,40,14,.OK ListBox 8,27,308,96,documentlist$,.thedocumentlist Text 10,139,160,11,"Press OK to open the selected document.",.Text1,,,ebBold TextBox 54,7,262,12,.TextBox1,,,,ebBold Text 5,9,43,8,"Use Case :",.Text2,,,ebBold PushButton 270,136,44,14,"Quit",.Quit PushButton 222,136,44,14,"Next",.Next End Dialog Dim theModel As Model Dim allUseCases As UseCaseCollection Dim theUseCase As UseCase Dim ListDocumentsDialog As ListDocuments Set allUseCases = RoseApp.CurrentModel.GetSelectedUseCases () If allUseCases.count = 0 Then r% = MsgBox ("No UseCase selected for processing" + crlf + crlf + _ "Do you want to process all the UseCases ? " + crlf , ebYesNo,"Process all UseCases") If r% <> ebYes Then Exit Sub Set allUseCases = RoseApp.CurrentModel.GetAllUseCases() End If For a = 1 To allUseCases.Count Set theUseCase = allUseCases.GetAt(a) ListDocumentsDialog.TextBox1$ = theUseCase.GetQualifiedName() Set theExternalDocs = New ExternalDocumentCollection If theUseCase.ExternalDocuments.Count <> 0 Then ReDim documentlist (1 To theUseCase.ExternalDocuments.Count) For b = 1 To theUseCase.ExternalDocuments.Count Set theExternalDocument = theUseCase.ExternalDocuments.GetAt(b) documentlist (b) = theExternalDocument.Path theExternalDocs.add theExternalDocument Next b r% = Dialog(ListDocumentsDialog) ' If r% = -1 And selectedIndex <> 0 Then ' Set theExternalDocument = theExternalDocs.GetAt(selectedIndex) ' isOpen = theExternalDocument.Open("") ' End If If r% = 1 Then Exit For End If Next a End Sub