FileSearch or file picker

Hap

Well-known Member
Joined
Jul 20, 2005
Messages
647
I am writing a program that needs to be compatible with xl2000. I would like to either return all the files with a particular extension in a give path or be able to use a dialog to search for a particular file. What I would like returned is the filename and path rather than opening directly in Excel. Am I going to have to write my own search? I'm assuming there is a windows api that I can make use of. The files are not necessarily excel files.

Thanks for any help.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
How about this. How would I populate a listbox with all the files in a particular folder of a given file extension?
 
Upvote 0
An example

Code:
Sub a()
Dim MyFolder As String
Dim MyFile As String
MyFolder = "M:\Stuff"
MyFile = Dir(MyFolder & "\*.xlsx")
Do While MyFile <> ""
    UserForm1.ListBox1.AddItem MyFile
    MyFile = Dir
Loop
UserForm1.Show
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,712
Members
452,939
Latest member
WCrawford

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