Issue with line wrap in source txt file when importing- please help

K

KR

I am getting a text file whose source I have no control over. In this text
file, when I use the import wizard in excel, I can parse each line in all
the right places, and pull my data into a worksheet.

However, when I use the commands to read a line at a time (I need the stuff
in an array, but don't need it actually imported into a worksheet) such as:

Open LongFN For Input As #1
Do While Not EOF(1)
Line Input #1, LineofText

the lines that are wrapped in the file end up coming in as /multiple/ lines
when I read the file a line at a time.

I have almost 30 discrete groups of data in some lines, so they wrap up to 3
or 4 lines. Trying to reconstruct the data from multiple lines (each data
group might have a different number of lines) would be a nightmare.

Is there a setting or a way to read a line all the way to the next "line
break" as seen by the import wizard, rather than truncating each line at
whatever the current setting is (probably 80 chars)? In the import wizard it
looks like the maximum is just over 700 characters. I suspect the issue is
that Line Input looks at either Chr(13) or (Chr(10)&Chr(13)), but I want it
to skip any Chr(13) and keep reading automatically until it hits a
(Chr(10)&Chr(13))

Please, please help.
Thank you,
Keith
 
K

KR

Nevermind- I have no idea why, but now it is working as expected. I wish I
knew why so I could prevent myself from changing back whatever it was that
fixed it, but at least for now it is working. Yea!
Thanks,
Keith
 

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