Application.FileSearch 2003 - 2007

fridaywizard

New Member
Joined
Jan 4, 2012
Messages
6
Having recently got 2007 installed on my computer at work, it is apparent that Application.Filesearch is no longer available in VBA.

Specifically; I need some code that will list the names of files in a folder in a column on my workbook.

I have a fairly basic knowledge of VBA and although I have read a number of similar posts on here I can not find any code that specifically does the above.

Please help! Can anyone give me an example of some code that will for example, look in folder "C:/" and list the filenames in column "A1:Ax" of my workbook?

Thanks a lot
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Yes, for reasons I have yet to figure out, Microsoft seemed to think that people didn't use Application.Filesearch.

Here is an alternative:

Code:
Sub test()
Dim c As String, x As Long
c = Dir("C:\*.*")
If c = "" Then Exit Sub
Do
   x = x + 1
   Range("A" & x) = c
   c = Dir
Loop Until c = ""
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,703
Messages
6,126,314
Members
449,308
Latest member
Ronaldj

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top