Dim iContador As Integer
Dim sFileName As String
Dim oFileSystem As Object, oParentFolder As Object, oFolder As Object
Set oFileSystem = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
Set oParentFolder = oFileSystem.GetFolder(sPath)
If oParentFolder Is Nothing Then
ProcurarArquivos = False
On Error GoTo 0
Set oParentFolder = Nothing
Set oFileSystem = Nothing
Exit Function
End If
sPath = IIf(Right(sPath, 1) = "\", sPath, sPath & "\")
sFileName = Dir(sPath & sFileSpec, vbNormal)
Do While sFileName <> ""
iContador = UBound(sFoundFiles, 2)
iContador = iContador + 1
ReDim Preserve sFoundFiles(1 To 2, 1 To iContador)
sFoundFiles(1, iContador) = sPath
sFoundFiles(2, iContador) = sFileName
sFileName = Dir()
Loop
If blIncludeSubFolders Then
For Each oFolder In oParentFolder.SubFolders
ProcurarArquivos oFolder.Path, sFoundFiles, iArqEncontrados,
sFileSpec, blIncludeSubFolders
Next
End If
ProcurarArquivos = UBound(sFoundFiles, 2) > 0
iArqEncontrados = UBound(sFoundFiles, 2)
On Error GoTo 0
Set oFolder = Nothing
Set oParentFolder = Nothing
Set oFileSystem = Nothing
End Function
carla scalaejcves
(Carla ScalaEjcveS)
#1