Opening Text Files and Re-Saving Them

B

BoRed79

Hi.

I am trying to write some code which will allow a user to select a folder
and then will open all of the text files in that folder and re-save them as
excel files.

I have sorted out the code to enable the user to select the folder they wish
to use, but am looking some assistance on the looping to enable each of the
text files to be opened and re-saved.

Can anyone suggest how I might do this.

Thanks.
 
D

Dave Peterson

If the text files are all the same, you could record a macro that Opens, saves
as an excel file, and closes the file.

Then that recorded macro could be modified to open all the text files in the
folder.

If the files vary in format, then maybe you could have different macros for each
type of text file.

Ron de Bruin has some code for working with CSV files that may be a good
starting point:
http://www.rondebruin.nl/tips.htm
(look for CSV)

If you need help tweaking your code, post back with your code and the version of
excel you're using--and the type of excel file you want to saveas.
 

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