Public Function FindFile(sFileName As String) As String
Dim fso As FileSystemObject Dim Drive As Drive Dim Folder As Folder Dim bFoundFile As Boolean On Error Resume Next Set fso = CreateObject("Scripting.FileSystemObject") For Each Drive In fso.Drives If bFoundFile = True Then Exit For If Drive.DriveType = Fixed Then For Each Folder In Drive.RootFolder.SubFolders If bFoundFile = True Then Exit For If fso.FileExists(Folder.Path & "\" & sFileName) = True Then FindFile = Folder.Path & "\" & sFileName bFoundFile = True End If Next End If Next End Function |