Re: Read an Input File
- From: Sinna <news4sinna_NOSPAM@xxxxxxxxxx>
- Date: Wed, 18 Jul 2007 08:31:19 +0200
Argusy wrote:
Mike wrote:It won't as you'll be parsing the file the same way as Line Input does.Hi,
I'm using the code below to read a CSV file (a copy of Excel file) into an Array
Open (filename.csv) For Input As 1
Count = 0
Do Until EOF(1)
Line Input #1, recorddata
myRecord(Count) = recorddata
Count = Count + 1
Loop
Close #1
But the problem is that one of the Cells in one row of my csv file contains a Carriage return character so when it comes to that cell it thinks that is the end of line and it breaks my one line to 2 lines. How can I fix that!?
try setting a buffer to take the whole file, import the file, then use the split function to populate an array, using vbCrLf.
I think that will work.
Argusy
If possible, you should encode the carriage return so it doesn't break a line.
Another suggestion: if the file you'll reading is in fact a CSV-file (a comma separated values file), you can use Input instead of Line Input.
The only thing you need to know is how many values there are for each record.
Sinna
.
- References:
- Re: Read an Input File
- From: Argusy
- Re: Read an Input File
- Prev by Date: Re: Trackball mouse problem
- Next by Date: Re: Listview sorting
- Previous by thread: Re: Read an Input File
- Next by thread: Re: Read an Input File
- Index(es):
Relevant Pages
|