MrExcel Publishing
Your One Stop for Excel Tips & Solutions

FILE IMPORTING


Posted by BENDAPT2 on January 25, 2002 10:20 AM

I would like to open a DOS exported directory listing file pre-separated into specified columns using Excel. The lines below are the commands used in a batch file run to create the XLS file which it does successfully, but all data is in the first column when open by double clicking the file. The exported file is usually exported to a simple text file (txt), but I changed the extention to xls, and it did open anyway, just in Excel. Are there any switches or commands in DOS following these commands that might specify to excel how to open the file, or is there perhaps, some other way of doing this? This move could help speed my production.

MD C:\FOLDER1\LIST
DIR C:\FOLDER1\*.JPG > C:\FOLDER1\LIST\FILES.XLS


Posted by Ed on January 25, 2002 7:43 PM

Instead of changing the file extension is .xls, import the file into excel and then define the columns. Record your steps utilizing a macro and save the file with the macro as a template file. Set the macro to autorun when you open the file. Each time you open the file it will read the latest .txt file and split it into the columns you defined when you first recorded the macro.