Olá AdGEre!
gosaria que vc implantasse no seu modelo, codigos parecidos com estes (acho que sao mais diretos e mais faceis de manutenção (obs: no meu modelos já tem):
---------------------------------------------------------------------------------------------------
Sub Sample()
ShowFolderList ("C:teste")
End Sub
Sub ShowFolderList(folderspec)
Dim fs, f, f1, fc, s, sFldr
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.SubFolders
For Each f1 In fc
If Right(f1, 1) <> "" Then ShowFolderList f1 & "" Else ShowFolderList f1
Next
Set fc = f.Files
For Each f1 In fc
Debug.Print folderspec & f1.Name
With Worksheets("Control")
Worksheets("Control").ListBox1.AddItem folderspec & f1.Name
End With
Next
End Sub
--------------------------------------------------------------------------------------------
Sub ShowFolderList2(folderspec)
Dim fs, f, f1, fc, s, sFldr
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.SubFolders
For Each f1 In fc
If Right(f1, 1) <> "" Then ShowFolderList2 f1 & "" Else ShowFolderList2 f1
Next
Set fc = f.Files
For Each f1 In fc
Debug.Print folderspec & f1.Name
If Sheets("Visualizador").OptionButton4.Value = True Then GoTo Lancar
Select Case UCase(fs.GetExtensionName(folderspec & f1.Name))
Case "JPG"
If Sheets("Visualizador").optJPG.Value = True Then
GoTo Lancar
Else
GoTo Pular
End If
Case "GIF"
If Sheets("Visualizador").optGIF.Value = True Then
GoTo Lancar
Else
GoTo Pular
End If
Case "BMP"
If Sheets("Visualizador").OptBMP.Value = True Then
GoTo Lancar
Else
GoTo Pular
End If
Case Else
GoTo Pular
End Select
Lancar:
Sheets("Visualizador").ListBox2.AddItem folderspec & "" & f1.Name
Pular:
Next
End Sub
Postado : 19/07/2015 8:25 am