View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Getting FileName from Search

Replace the msgbox with this if the file is closed:

name .foundfiles(i) as "C:\somenewname\here.xls"

Look at VBA's help for the Name statement for more info.

Rick wrote:

Dave;
Yes it does, but how do you save it so one can alter the name?

"Dave Peterson" wrote:

Doesn't the msgbox give you the filename?

Rick wrote:

I am using this search:
With Application.FileSearch
.LookIn = DefaultFilePath
.TextOrProperty = FleNme
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) 0 Then
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With

How can I retrieve the file name?
I've tried everything I know, which isn't much.


--

Dave Peterson


--

Dave Peterson