I wanna import data from a text file....


Posted by Todd on July 05, 2001 7:47 AM

Hi,
I need to be able to import certain (not all) information from data points in a text file into a worksheet. I have tried using a data query with the delimiting criteria set to seperate the columns using commas. It works, but doesn't get all the points I'm interested in. The problem is that the orginaization of the data is not very good. The information I'm interested in will sometimes be buried in three lines and other times buried in two for each data point. I wanna know if there is a better way to get the data onto a worksheet without having to reformat each text file so that each data piont's information takes up one line?

Posted by Damon Ostrander on July 05, 2001 9:03 AM

Hi Todd,

VBA has standard file I/O capabilities using statements like Open, Line Input #, Input #, Get #, etc., to read data from a file. I use these all the time for things like you describe, and they give you lots of control over the way you read a file whose data formats vary within the file. I suggest you look into these in the VBA helps. One of the extra advantages is that you do not have to read the data into an Excel spreadsheet.

Damon



Posted by Todd on July 05, 2001 10:35 AM

Thanks Damon,
I'll look into it. I have been trying to write a macro in Word without any success. I'll try what you suggested.

-Todd