LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Application.FileSearch challenge

Greetings !

Here's a snippet from a VBA routine
wot doesn't work as I had hoped / expected :

===================================
.....etc...

'Get the contents of the SOURCE Directory,

Set fsS = Application.FileSearch

With fsS
.LookIn = mySourcePath$
.FileName = "*.*"
If .Execute(SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending)
= 0 Then
MsgBox "There were no files found."
Else
TotSourceFiles = .FoundFiles.Count
End If
End With

'Get the contents of the TARGET Directory

Set fsT = Application.FileSearch

With fsT
.LookIn = myTargetPath$
.FileName = "*.*"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) = 0 Then
MsgBox "There were no files found."
Else
TotTargFiles = .FoundFiles.Count
End If
End With

'For each file therein,

For N = 1 To TotTargFiles

With fsS
SourceFile = .FoundFiles(N)
End With

myFileName = FileName((SourceFile))

'Check the name against the names in the SOURCE Directory.
For M = 1 To TotSourceFiles

....... etc....
===================================

Why, oh Why, does the fsS set adopt the same values as the fsT set ???

In the Immediate Window, the sets are shown as different sets,
and yet the original values in fsS ar replaced when it reads in values for
fsT.

Be that as it may, my question is, what can I do about it ?


Help?


Regards

Robin Clay
Robin_B DOT Clay AT virgin DOT net
In Dorset's Blackmore Vale
 
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
Application.FileSearch Cleberton(Brazilian) Excel Discussion (Misc queries) 2 October 26th 09 01:21 PM
Application.FileSearch on only one level of sub folders Crustysquirrel Excel Programming 3 August 3rd 05 09:18 AM
Help with Application.FileSearch method Roy Harrill Excel Programming 4 August 1st 05 12:56 AM
Application.FileSearch is not working?? alondon Excel Programming 5 January 18th 05 03:12 AM
VBA Application.FileSearch Roger Frye Excel Programming 0 March 5th 04 04:07 AM


All times are GMT +1. The time now is 03:27 PM.

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

About Us

"It's about Microsoft Excel"