Search in a Folder and Subfolders for parts and assemblys

I am trying to wright a macro that will search in a given directory to find the specified part or assembly and add them into an assembly if they exist.

I am having an issues in searching the suborders and cant figure out what to do. I can return if the file exists in the folder but it dosent seem to work for files in sub folders

Here is what i am using

Dim row             As Integer

Dim Str             As String

Dim Count           As Integer

Dim SWPrtLC         As String

Dim SFolder         As String

Dim SearchSte       As String

Dim FNameL          As Integer

Dim SName           As String

Dim SFile           As String

Sub main()

SFolder = "C:\Temp\"

SName = Dir(SFolder)

Do Until SName = ""

FNameL = Len(SName)

SFile = Mid(SName, 1, FNameL - 7)

    If SName = "." Or SName = ".." Then

    Else

       

        If Right(SName, 6) = "sldprt" Or Right(SName, 6) = "sldasm" Or Right(SName, 6) = "SLDPRT" Or Right(SName, 6) = "SLDASM" Then

       

            If SFile = "168131000" Then

           

            On Error Resume Next

            MsgBox (SName)

           

            End If

       

        End If

   

    End If

SName = Dir

Loop

End Sub

SolidworksApi macros