Read Text File via VB

  • Thread starter Thread starter ml
  • Start date Start date
M

ml

I am attempting to get around an exporting problem by
writing code to read each line of a text file and write
only the non-blank lines to another file.

The text file I am reading has imbedded commas on most
lines because of its intended use in another system. I
simply want to get rid of the extra blank lines.

The problem I am running into is that the INPUT statement
uses the commas as field separators. So I would need
multiple fields, not to mention the issue that not every
line has a comma compounds the problem.

I would like to be able to read a certain number of
characters that represents each line (say 132), determine
if the line is blank, then write it to another file if not
blank.

Is something like this viable or am I out of luck?

Thanks.
 
ml said:
I am attempting to get around an exporting problem by
writing code to read each line of a text file and write
only the non-blank lines to another file.

The text file I am reading has imbedded commas on most
lines because of its intended use in another system. I
simply want to get rid of the extra blank lines.

The problem I am running into is that the INPUT statement
uses the commas as field separators. So I would need
multiple fields, not to mention the issue that not every
line has a comma compounds the problem.

I would like to be able to read a certain number of
characters that represents each line (say 132), determine
if the line is blank, then write it to another file if not
blank.

Try using the InputLine method instead of Input.
 
John said:
Hi Marsh,



It's Line Input # , not InputLine, isn't it?


Details, details ... ;-\

Of course you're right John, thanks for straightening that
out.
 
Back
Top