wazz
Super Moderator
- Local time
- Today, 14:31
- Joined
- Jun 29, 2004
- Messages
- 1,711
i'm having trouble writing/interpreting the filetype property of this code. the code searches all files in a folder and returns many different file types but prints "1" as the .FileType for every file. how do i get it to print "Microsoft Word Document" or "BMP File" or "Outlook Item" as appropriate?
Code:
Public Function SearchFolder()
Dim fs As FileSearch
Dim i As Integer
Set fs = Application.FileSearch
With fs
.LookIn = "C:\Documents and Settings\wazz\etc."
.SearchSubFolders = True
.FileType = msoFileTypeAllFiles
'.FileName = "*.*"
If .Execute() > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
Debug.Print Mid(.FoundFiles(i), InStrRev(.FoundFiles(i), "\") + 1) & " " & FileLen(.FoundFiles(i)) & " " & .FileType
Next i
Else
MsgBox "There were no files found."
End If
End With
End Function