Alternative to FileSearch for Finding Directories
Hi AC,
As an alternative, try:
'=============
Public Sub TesterA1()
Dim WB As Workbook
Dim SH As Worksheet
Dim rng As Range
Dim rCell As Range
Const myPath As String = "C:\"
Set WB = Workbooks("YourBook.xls") '<<==== CHANGE
Set SH = WB.Sheets("Sheet1") '<<==== CHANGE
Set rng = SH.Range("A2:A20") '<<==== CHANGE
For Each rCell In rng.Cells
With rCell
.Select
.Offset(0, 1).Value = DirectoryExists(myPath & .Value)
End With
Next rCell
End Sub
'-------------
Public Function DirectoryExists(fldr As String)
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
DirectoryExists = FSO.FolderExists(fldr)
End Function
End Function
'<<=============
Or, dispense with the Tester macro, and use the function directly in the
worksheet, e.g.:
=DirectoryExists($C$1 & A1)
where C1 holds the folder path
---
Regards,
Norman
wrote in message
oups.com...
I was extremely excited when I found FileSearch - it seemed like the
solution to an issue I hadn't manage to get round. Until I found out
the Filesearch isn't actually reliable and this was an issue on my
machine. So now I'm looking for an alternative.
I have a collection of directories which are named by a 12 digit part
number and a part name. I also have an excel sheet with the list of
part numbers in. I want to test to see if all the directories exist .
. .without using filesearch.
Does anyone have any brilliant ideas?
Thanks
|