View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Filename from the result of a Filesearch

Paulo,

With Application.FileSearch
..NewSearch
..LookIn = "C:\Documents and Settings"
..Filename = "*.xls"
If .Execute 0 Then
For i = 1 To .FoundFiles.Count
MsgBox Mid(.FoundFiles(i), InStrRev(.FoundFiles(i), "\") + 1, _
Len(.FoundFiles(i)))
Next i
End If
End With

HTH,
Bernie
MS Excel MVP


"pauloreiss" wrote in message
...

When I request Application.FileSearch.filename i get the name of the
file i searched. In my case "*.xls".
I would like to get the name of the file that the search found.
The Application.FileSearch.foundfiles gives me the full path. How do i
get only the name of the file???


--
pauloreiss
------------------------------------------------------------------------
pauloreiss's Profile: http://www.excelforum.com/member.php...o&userid=29820
View this thread: http://www.excelforum.com/showthread...hreadid=497901