Filesearch error in Excel

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

*** Sent via Developersdex http://www.developersdex.com ***
 
P

Patrick Molloy

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
 
P

Patrick Molloy

apologies for a typo
Microsoft Scrioting Runtime
should of course be
Microsoft Scripting Runtime
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top