I understand that the answer to this question may be similar to another, but the question is posed in a different way. This question is based on the fact that the user, me, did not know FileSearch
was removed. The other is conceptually based, and contains prior knowledge of excel's 2010 changes...
I have found some code here
Sub Search()
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objSearch = objExcel.FileSearch
objSearch.Lookin = "D:\Music"
objSearch.SearchSubfolders = TRUE
objSearch.FileName = "*.wma"
objSearch.Execute
For Each strFile in objSearch.FoundFiles
Wscript.Echo strFile
Next
objExcel.Quit
End Sub
I tried to run that code on my machine, with it adapted to one of my folders and an extention within the folder, but it returned an error 445 (object doesn't support this action). I'm using excel 2010.
Does anyone know what's going on? I'm trying to help out a co-worker, but I don't know much about File I/O beyond the simple stuff in VBA.