PDA

View Full Version : Solved: Confirming filename found after wildcard search



Asterix
02-26-2008, 04:25 AM
With Application.FileSearch

.LookIn = "O:\NGMData7\Reserved\IT Library\Scheduling\Resource Allocations\Resource Allocations Spreadsheet"
.Filename = "Resource Allocations*.xls"

Application.StatusBar = "Please be patient..."

If .Execute > 0 Then

Hello all, assuming .Execute is greater than 0, how do I then extract the name of a/the file (i.e not the path) that I have successfully found (during the wildcard match)?

I could work out how to do this using a text extract formula but it seems long winded and I wondered if I'm just missing a property.

Thanks.

Asterix
02-26-2008, 05:03 AM
Would still be interested if a property exists but I solved this by extracting the filename using...
filenamestring = Mid(.FoundFiles(1), InStrRev(.FoundFiles(1), "\") + 1)

Bob Phillips
02-26-2008, 05:08 AM
No, that is the way to do it.

Asterix
02-26-2008, 06:04 AM
thankyou

Norie
02-26-2008, 06:45 AM
There's no property but there is another way - Dir.

filenamestring = Dir(.FoundFiles(1))

Asterix
02-26-2008, 07:03 AM
Thanks, I'll try that once I've retyped the entire macro (must remember to save files as a specific filename in order to prevent absent-mindedly pressing "No" as a response to "Do you want to save changes to Book1?")