Gather all file names from a file path

tuktuk

Well-known Member
Joined
Nov 13, 2006
Messages
856
hye there,

is there a way to write code in a module to import all .xls file name from a static filepath.

append to a tbl_AllxlsFiles.

it kind of a strange request but i really dont know where to start except for:

define the FilePath....

<gathere the file names>

use an insert into table stepping thru the recordset.

thanks
tuktuk
 
I needed to do something similar to this again, and started searching. I found this post that linked to my old post where I was conversating with myself........

Anyway I ran into the same problem as tuktuk. Dir is not linking to the path that was specified. I found a solution, it appears that you must first change the drive to properly change the directory.

Basically all you need to do is add ChDrive "C" before ChDir. C being the drive letter I want to be in.

For ex.:

theFilePath = "C:\Documents and Settings\ethw0430\Desktop\Pay Files\"
ChDrive "C"
ChDir theFilePath
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,223,098
Messages
6,170,100
Members
452,301
Latest member
QualityAssurance

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