Filesearch error in Excel

  • Thread starter Thread starter Brett Nykiforuk
  • Start date Start date
B

Brett Nykiforuk

Hi,
Can any one tell me how to enable a class in the object browser in VBA?
Filesearch is listed there in the hidden objects but it isn't enabled.
Is this possible, even though Microsoft took it out of Office 2007?

Thanks,

Brett
 
This has been dropped in 2007.
see
http://support.microsoft.com/kb/935402/en-us
recommended use of the DIR() function or the FileSystemObject
The FileSystemObject is part of the Microsoft Scrioting Runtime, so in the
IDE set a reference to this (Tools/references)
Its not so easy, but here's an example to give you something to play with

OPTION EXPLICIT
Sub MyFileSearch()
Dim sfoFile As Scripting.File
With New FileSystemObject
For Each sfoFile In .GetFolder("C:\temp").Files
With sfoFile
If .Name Like "*.CSV" Then
Debug.Print .Name, .Type
End If
End With
Next
End With
End Sub
 
apologies for a typo
Microsoft Scrioting Runtime
should of course be
Microsoft Scripting Runtime
 
Back
Top