importing multiple text files

T

tgwarrior

I have several hundred text files that I'd like to import to access and have
them all appended to one table. I can very simply import one text file at a
time, but this is cumbersome and inefficient. Is there a way to import text
files that are housed in a directory/folder? Or any way to set up a macro
that will import more than one text file at a time?


Thank you.


michael munson
(e-mail address removed)
 
J

John Vinson

I have several hundred text files that I'd like to import to access and have
them all appended to one table. I can very simply import one text file at a
time, but this is cumbersome and inefficient. Is there a way to import text
files that are housed in a directory/folder? Or any way to set up a macro
that will import more than one text file at a time?

You can't (readily) do this in a Macro but it's quite possible in VBA.
There is a Dir() function in VBA which retrieves the filenames in a
directory, and a TransferText method which imports the files (with the
option of appending them to a table). Without knowing more about the
specifics of your situation I can't suggest exact code, but try the
online help in the VBA editor for those two features to see if that
gets you started.

John W. Vinson[MVP]
 

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