Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Filename from the result of a Filesearch


When I request Application.FileSearch.filename i get the name of th
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
get only the name of the file??

--
pauloreis
-----------------------------------------------------------------------
pauloreiss's Profile: http://www.excelforum.com/member.php...fo&userid=2982
View this thread: http://www.excelforum.com/showthread.php?threadid=49790

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
set filename to <filename-date on open bob engler Excel Worksheet Functions 2 July 13th 06 05:11 AM
FileSearch FileName using wildcard (?) Werner Rohrmoser Excel Programming 1 June 16th 05 10:35 AM
vlookup and filename returning same result on each sheet. RogueSwan Excel Discussion (Misc queries) 3 March 22nd 05 10:08 PM
Saving filename same as import filename Matt Excel Programming 4 February 24th 04 03:01 PM
FileSearch gives unexpected result Stephen Allen[_2_] Excel Programming 2 December 21st 03 01:06 PM


All times are GMT +1. The time now is 12:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"