C
Chip
I am trying to create a list of all the files in a particular directory
(including subdirectories).
The Patternmatch property of the FileFind object looks like it should
do the trick.
What's wrong with this code? As it stands, it just returns two files
that happen to have asterisks in their filenames...
Public Sub grabfiles()
With Application.FileFind
.Options = msoOptionsNew
.PatternMatch = True
.FileName = "*"
.SearchSubFolders = True
.SearchPath = "Your disk:Your path"
.Execute
With .FoundFiles
If .Count > 0 Then
MsgBox "There were " & .Count & _
" file(s) found."
For i = 1 To .Count
mysize = FileLen(.Item(i))
MsgBox .Item(i) & " " & mysize
Next i
Else
MsgBox "There were no files found."
End If
End With
End With
End Sub
(including subdirectories).
The Patternmatch property of the FileFind object looks like it should
do the trick.
What's wrong with this code? As it stands, it just returns two files
that happen to have asterisks in their filenames...
Public Sub grabfiles()
With Application.FileFind
.Options = msoOptionsNew
.PatternMatch = True
.FileName = "*"
.SearchSubFolders = True
.SearchPath = "Your disk:Your path"
.Execute
With .FoundFiles
If .Count > 0 Then
MsgBox "There were " & .Count & _
" file(s) found."
For i = 1 To .Count
mysize = FileLen(.Item(i))
MsgBox .Item(i) & " " & mysize
Next i
Else
MsgBox "There were no files found."
End If
End With
End With
End Sub