DFragnDragn
Board Regular
- Joined
- Mar 6, 2010
- Messages
- 81
I can't seem to respecify the path properly with a Dir or the fso conversion for the retired FileSearch.
I'm just mucking it up with
Set fso = CreateObject("Scripting.FileSystemObject")
And is Called via:
I'm just mucking it up with
Set fso = CreateObject("Scripting.FileSystemObject")
Code:
Function Find_File(file_to_find As String) As String
Dim found_file As Variant
Dim wb As Workbook
Dim response As Integer
With [COLOR=DarkRed]Application.FileSearch[/COLOR]
For drive_char = 65 To 90
.NewSearch
.filename = "filename"
.LookIn = Chr$(drive_char) & ":"
.FileType = msoFileTypeExcelWorkbooks
.SearchSubFolders = True
If .Execute() > 0 Then
Find_File = .FoundFiles(1)
Exit Function
End If
Next
End With
Find_File = "Not Found"
End Function
Code:
Dim file_location As String
file_location = Find_File("xyz.xltm")
MsgBox file_location