|
-
Mar 29th, 2003, 06:50 AM
#1
Thread Starter
Member
CSV Files & Carriage Returns
I have CSV files that I’m reading via a VB program; I have a problem with the following code
__________________________________________________
Open MYCSVFILE For Input As #filenum
Do Until EOF(filenum)
Line Input #filenum, str
Debug.print str
''''''''''''''''''''''‘My Processing
Loop
__________________________________________________
The problem is that one of the fields contains data collected from user entry (Got no control over this process) and the fifth field can contain anything such as comma’s and carriage returns. With the comma’s all we done in replace any found after the 5th occurrence of a comma…Not great but it works. The problem I have is with the carriage returns as it breaks the line is the wrong place.
How do I stop it happening, is there another way I can read the data line by line????
-
Mar 29th, 2003, 02:10 PM
#2
PowerPoster
you ARE reading the file line by line and I don't think any other method is going to make a difference because the end of the line is DEFINED by the presence of a CR and thus if you have a CR any method that reads line by line will see a new line at the CR.
I think you'll either need to get rid of the CR as it goes INTO the file, not as you read the file, or else you're going to have to spot some other clue on how you parse the file.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|