R
Robin Clay
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
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