Import data from multiple files

D

Dean

Hi,

I currently have a data query that imports data from multiple "TEXT" files
in a folder one file at a time when I select them.

I have to individually select the file, the query is run and imports the data.

Is it possible to have Excel open a folder, select all the files
(individually or all together) and import the data. the files are CSV.

I can then manipulate the data once it's in but the time consuming bit is
getting it in. I would use MS Access but don't have it....YET!

Thanks in advance.....
 
J

Jacob Skaria

Daear Dean

The below code should do.......

Dim strFolder, strFile

strFolder = "C:\"
strFile = Dir(strFolder & "*.csv", vbNormal)
Do While strFile <> ""
'Write your import code here
strFile = Dir
Loop


If this post helps click Yes
 

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