ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filesearch error in Excel (https://www.excelbanter.com/excel-programming/431240-filesearch-error-excel.html)

Brett Nykiforuk

Filesearch error in Excel
 


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 ***

Patrick Molloy

Filesearch error in Excel
 
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



"Brett Nykiforuk" wrote in message
...


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 ***



Patrick Molloy

Filesearch error in Excel
 
apologies for a typo
Microsoft Scrioting Runtime
should of course be
Microsoft Scripting Runtime

"Patrick Molloy" wrote in message
...
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



"Brett Nykiforuk" wrote in message
...


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 ***




All times are GMT +1. The time now is 10:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com