home
Google


Loop though all files in a SourceSafe database
Author Nigel Rivett

This code will open the SourceSafe database and loop throgh each file in the database.
The debug.print statement will print the project path and name of each file in the database
Add the SourceSafeTypeLib reference to the project.


Sub main()
Dim objSS As New SourceSafeTypeLib.VSSDatabase
Dim objSSItem As SourceSafeTypeLib.VSSItem
Dim objSSItem2 As SourceSafeTypeLib.VSSItem
Dim aProject() As String
Dim sProject As String
Dim SSDatabase As String
Dim i As Integer
    SSDatabase = "c:\VSSTest\srcsafe.ini"
    SourceFolder = "c:\VSSTestData\"
    
    objSS.Open SSDatabase ', "Admin", ""
    ReDim aProject(1) As String
    aProject(1) = "$/"
    i = 0
    Do While i < UBound(aProject())
        i = i + 1
        sProject = aProject(i)
        Set objSSItem = objSS.VSSItem(sProject)
        For Each objSSItem2 In objSSItem.Items
            If objSSItem2.Type = VSSITEM_PROJECT Then
                ReDim Preserve aProject(UBound(aProject()) + 1) As String
                aProject(UBound(aProject())) = sProject & objSSItem2.Name & "/"
            Else
                Debug.Print sProject & objSSItem2.Name
            End If
        Next
    Loop
    
End Sub



home