
Reading CSV Files in XL-VBA
Lars,
Thanks for the response. However, the original CSV files (over which I have
no control, as they came from other people) have double-quotes as text
qualifiers and commas as field separators! In addition, they still have
instances of double-quotes and / or commas within the field data. It sounds
almost impossible to distinguish between data and separators/qualifiers.
However, it is not impossible because if I open the CSV files directly with
Excel, it correctly spots the difference and shows commas and / or
double-quotes in the data as appropriate. The same is true if I import the
CSV file into an Access table. What I am now trying to find out is what
logic is used by Excel / Access to spot the difference so that I can then
use the same logic in my routine!
Regards,
Brian
Quote:
----- Original Message -----
Sent: Saturday, June 09, 2001 9:47 PM
Subject: Re: Reading CSV Files in XL-VBA
> Try changing your Windows Regional Settings to using a semi-colon list
> separator instead of a comma and (if I remember correctly without having
> Excel re-installed on this machine) there's an option of NOT using
> double-quotes for grouping.
> /Lars Hammarberg
> (If your CSV contains semi-colons within the field data - try another
> separator that's NOT in the text, like or ? or * or whatever)
> ----- Original Message -----
> Newsgroups: microsoft.public.office.developer.vba
> Sent: Saturday, June 09, 2001 21:13
> Subject: Reading CSV Files in XL-VBA
> > Hello,
> > I wonder if anyone could help me?
> > For several days I have been trying to write a routine in VBA (Excel97)
> that
> > will read a CSV file created by another program. The trouble is, the
CSV
> > file sometimes has double-quotes and / or commas within the field data!
> > I have been going round and round in circles and I would be grateful if
> > anyone could advise me how to solve this problem.
> > Thanks in anticipation,
> > Brian
Quote:
> Hello,
> I wonder if anyone could help me?
> For several days I have been trying to write a routine in VBA (Excel97)
that
> will read a CSV file created by another program. The trouble is, the CSV
> file sometimes has double-quotes and / or commas within the field data!
> I have been going round and round in circles and I would be grateful if
> anyone could advise me how to solve this problem.
> Thanks in anticipation,
> Brian