Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Application.FileSearch challenge
There is only one filesearch, you are just creating two references to it.
So when you do you second file search, you are resetting the only filesearch. copy out your values to an array before you do the second file search -- Regards, Tom Ogilvy "Robin Clay" <Robin_B DOT Clay AT virgin.net wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Application.FileSearch challenge
Possibly
http://www.diydatarecovery.nl/chkmate.htm for your .chk problem. -- Regards, Tom Ogilvy "Robin Clay" <Robin_B DOT Clay AT virgin.net wrote in message ... 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Application.FileSearch challenge
"Tom Ogilvy" wrote:
Possibly http://www.diydatarecovery.nl/chkmate.htm for your .chk problem. Thank you, Tom, for a double helping of your assistance - yet again ! -- Regards Robin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Application.FileSearch | Excel Discussion (Misc queries) | |||
Application.FileSearch on only one level of sub folders | Excel Programming | |||
Help with Application.FileSearch method | Excel Programming | |||
Application.FileSearch is not working?? | Excel Programming | |||
VBA Application.FileSearch | Excel Programming |