title: Iterate through the folder and find a particular file
body: <p>I have written this code to iterate through the folders and exit the function when it finds the ".c" file. Ideally it should return the path of the ".c" file. But its returning empty string.</p>
  
  <pre><code>tval = 1
  Function findStlcode(objFSO,fFolder,folderName)
      Set objFSO = CreateObject("Scripting.FileSystemObject")
      Set Folder = objFSO.GetFolder(fFolder)
      Set colfiles = Folder.Files
      For Each objFile In colfiles
          strFilename = objFile.name
          If strcomp(strFilename,folderName &amp; ".c",vbTextCompare) = 0 Then
              findStlcode = fFolder &amp; "\" &amp; folderName &amp; ".c"
              tval = tval + 1
              Exit Function
          End If
      Next
      For Each Subfolder In Folder.SubFolders
          If tval = 1 Then
              xx = findStlcode(objFSO, Subfolder.Path, folderName)
          End If
      Next
  End Function
  </code></pre>