Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default Getting FileName from Search

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Getting FileName from Search

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default Getting FileName from Search

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
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
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 334
Default Getting FileName from Search

Thanks Dave, I give it a try.

"Dave Peterson" wrote:

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

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
Converting a Variable Filename to a Constant Filename Magnivy Excel Programming 2 August 15th 06 06:13 PM
filename search and extract into a cell M John Excel Discussion (Misc queries) 5 April 28th 06 10:11 PM
Help with filename search Jimbo1[_5_] Excel Programming 5 March 28th 06 10:40 PM
Search filename containing words Bob Phillips[_6_] Excel Programming 0 December 22nd 04 09:44 AM
Filename search using Office 97 with Windows 2000 Dave[_30_] Excel Programming 3 September 15th 03 04:57 PM


All times are GMT +1. The time now is 12:45 PM.

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"