jag108
Active Member
- Joined
- May 14, 2002
- Messages
- 433
- Office Version
- 365
- 2016
- Platform
- Windows
- MacOS
Hello All,
I need to have a working piece of VBA to look through a starting folder and collect information about all file and folders in hte "root" folder.
I need this to also keep going if therer are no files just folders.
At the moment the code I have works until it comes across a folder with just folders in it, then it assumes that there are no more directories with files/folders in.
Thanks in advance for all help offered.
I need to have a working piece of VBA to look through a starting folder and collect information about all file and folders in hte "root" folder.
I need this to also keep going if therer are no files just folders.
At the moment the code I have works until it comes across a folder with just folders in it, then it assumes that there are no more directories with files/folders in.
Code:
Do Until temp_var = ""
'Checks to see if temp_var is an empty string
If temp_var <> "" Then
'The following code will create an array of the directories
If GetAttr(directory_text & temp_var) And vbDirectory And Mid$(temp_var, 1, 1) <> "." Then
'enlarge the array to hold a new item
ReDim Preserve dir_array(counter)
'add directory to the array
dir_array(counter) = directory_text & temp_var & "\"
'Increase counter to make room for the next directory
counter = counter + 1
localcounter = localcounter + 1
End If
End If
'Temp_var stores the individual Directory name
temp_var = Dir()
Loop
Thanks in advance for all help offered.