Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. Function listFiles(ByVal get_Path As String)
  2.  
  3. Dim myArray As Variant
  4. Dim i As Integer
  5. Dim counter As Integer
  6. Dim xFile As Object
  7. Dim FileServ As Object
  8. Dim the_Folder As Object
  9. Dim the_Files As Object
  10.  
  11. Set FileServ = CreateObject("Scripting.FileSystemObject")
  12. Set the_Folder = FileServ.GetFolder(get_Path)
  13. Set the_Files = the_Folder.Files
  14.  
  15. If the_Files.Count = 0 Then
  16. Exit Function
  17. End If
  18.  
  19. ReDim myArray(1 To the_Files.Count)
  20.  
  21. i = 1
  22. For Each xFile In the_Files
  23. myArray(i) = xFile.Name
  24. i = i + 1
  25. Next
  26.  
  27.  
  28. listFiles = myArray
  29.  
  30. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement