importing CSV files correctly?

  • Thread starter Mathias Körber
  • Start date
M

Mathias Körber

I have an app which generates CSV files which include only text in
several columns, some of which can have embedded newlines.

I need to import these into EXCEL for editing and saving back into the
same format.

Generally, EXCEL handles this ok by just opening the CSV file. As long
as all fields are properly quoted, things work.

EXCEPT for when a field contains just the text "true" or "false".
EXCEL will change these values to ' TRUE ' and ´ FALSE '
(centered!) on import ! ARGH!

Using the text-import wizard and setting all columns to 'text'
(what a chore, to be done every time!) works in that respect, but
apparently breaks the import of multiline fields.

Is there any way to tell EXCEL to import a CSV file correctly??\

I am using Excel 2000 (9.0.6926 SP-3)
 
M

Mike

I used the code below and provede you have the import cells formatted as text
then true & false wre imported correctly and no capitalised.

Sub gettext()
x = 1
Open "c:\trial.txt" For Input As #1
Do While Not EOF(1)
Input #1, data$
Worksheets("Sheet1").Cells(x, 1).Value = data$
x = x + 1
Loop
Close #1
End Sub
 

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