Text files to Excel. - old forum post


#1

paulmatty1

Joined on 02-24-2004
Posts 8
text files to excel

Could someone tell me how to import the data log files which are produced in a text format into excel. Any code for vba to do this would be excellent but I know nothing of vba coding so it would have to be already written. Regards
Report
05-21-2004, 4:23 PM
javier

Joined on 12-11-2003
Posts 4
Re: text files to excel

When you open the text file in Excel you’ll see a wizard and will be asked about the delimited character. The delimited character is the one that identifies every column in the file. The most common character is the comma but this is configurable both in OptoDisplay as well as in Excel. This way Excel will take a text file like this Date,Time,tanques:String.REPORTE_DE_ALARMA 2004/04/20,16:54:50,Alta Temperatura Tanque4 2004/04/20,17:14:10,Alta Temperatura Tanque4 and put the data in the correct cell. Hope this helps, Javier
Report
05-23-2004, 3:40 PM
paulmatty1

Joined on 02-24-2004
Posts 8
Re: text files to excel

Thanks for your reply, it helps but I have some code to do this procedure but it only pastes in the cell which is active, consequently if you forget to make the correct cell active before pasting then you have to start again with the file import unless you cut and paste or move the cells but its not very professional. I am looking to import the text file to a specific cell and may need to change the code I have to accomplish this. Thanks for your time.
Report
05-29-2004, 8:52 AM
barrett

Joined on 04-07-2004
St. Louis, MO
Posts 27
Re: text files to excel

I have some vba code which when the Excel files is executed by ioDisplay “applications” saves itself as a new as a “new time and date name.xls”, brings the data into a spreadsheet from the Opto csv file, prints out the other spreadsheet which is formated and references the imported data sheet for it’s data, then closes itself. Opto executes this file (which is a default excel name) by a trigger which is time based in the ioControl strategy, then when Excel opens it looks at the system date and concatenates a file name to match the previous day or month, then opens that csv file name with an import function. The name which Opto uses to name the csv file is a string routine in ioControl based on the time and date which ioDisplay uses to name the histroy file. This could be simplified by just using the Opto history file naming convention and then modifying the vba code to build a name based on that convention. Give me you email, and I’ll send you some files.