Importing text columns in csv file

K

Kelvin Smith

Is there any way to force Excel to treat a column of data
in a .csv file as text, rather than as "general"? I have a
column of numbers for which I need to keep the leading
zeroes (zip codes), and standard behavior opening a .csv
file treats the value as a number and strips the zeroes.
I'm using a macro, but using FieldInfo:=Array(Array(1, 2))
as a qualifier on Workbooks.OpenText doesn't seem to have
any effect on a .csv file, though it works fine for a .prn
or .txt file.

Is my only choice to rename the file? I guess I can do
that inside the macro, but it seems a very inconvenient
way to get a very basic operation done.
 
P

pikus

Before the data is moved you should format the cells as text:
Main Menu Format-->Cells-->"Number" Tab Select "Text"

You may need to paste using a right click and "Paste Special"/"Values"

-Piku
 
G

Guest

Sorry, this doesn't help. I'm not copying and pasting; I'm
pulling the information in from a .csv text file.

Kelvin Smith
 

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