Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Converting a Variable Filename to a Constant Filename | Excel Programming | |||
filename search and extract into a cell | Excel Discussion (Misc queries) | |||
Help with filename search | Excel Programming | |||
Search filename containing words | Excel Programming | |||
Filename search using Office 97 with Windows 2000 | Excel Programming |