Get releases under a specified folder that match a filter
Public Sub FindReleases()

' Get releases under a specified folder that match a filter

Dim FolderId As Long, RelName As String
Dim folderFactory As ReleaseFolderFactory
Dim relFactory As ReleaseFactory
Dim FolderFilter As TDFilter
Dim listOfReleases As List
Dim rel As TDAPIOLELib.Release
Dim folder As ReleaseFolder

    ' Get ReleaseFolderFactory from TDConnection.
    Set folderFactory = tdc.ReleaseFolderFactory
    ' Get the folder in which to search.
    FolderId = 102
    Set folder = folderFactory.Item(FolderId)
    'Since the release factory is from the folder,
    '  all objects created from it relate to the
    ' contents of that folder.
    Set relFactory = folder.ReleaseFactory
    ' If the release factory were from the TDConnection,
    ' the objects would relate to all releases.
    ' For example: Set relFactory = tdc.ReleaseFactory
    Set FolderFilter = relFactory.Filter
    RelName = "Release*" 'Release 1, Release to QA, Release1.1, and so on.
    'Get the list of the Releases in the folder that
    ' match "Release*"
    FolderFilter.Filter("REL_NAME") = RelName
    Set listOfReleases = FolderFilter.NewList
    For Each rel In listOfReleases
        Debug.Print rel.Name
    Set folderFactory = Nothing
    Set relFactory = Nothing
    Set FolderFilter = Nothing
    Set listOfReleases = Nothing
    Set folder = Nothing
    Set rel = Nothing
End Sub