Private Function SearchForTests(SearchString As String) As List ' Search for tests that match a search string Dim TestSearchF As ISearchableFactory Dim SearchOpts As SearchOptions Dim tList As List Dim oneTest As Test Dim i, limit Dim tfact As TestFactory On Error GoTo ErrorHandler Set tfact = tdc.TestFactory ' Cast the TestFactory to get an ISearchableFactory reference. Set TestSearchF = tfact Set SearchOpts = TestSearchF.CreateSearchOptions ' Determing whether to search in test steps. SearchOpts.Property(SEARCH_IN_STEPS) = False ' Get the list of matches and output. Set tList = TestSearchF.Search(SearchString, SearchOpts) limit = 30 If (tList.Count < limit) Then limit = tList.Count For i = 1 To limit Set oneTest = tList.Item(i) Debug.Print oneTest.ID & " - " & oneTest.name Next i Set SearchForTests = tList Exit Function ErrorHandler: Set SearchForTests = Nothing End Function