View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
David Biddulph[_2_] David Biddulph[_2_] is offline
external usenet poster
 
Posts: 8,651
Default EXCEL read a text string as scientific notation

A CSV is *not* formatted; it is comma separated *text*.

The problem is not in in the CSV, but in the way that your downstream
application is interpreting the data from the CSV. You may be able to fool
the downsteam application by throwing in spaces, or things like CHAR(160),
or surrounding the text string with quotes, or preceding it by an
apostrophe, or a variety of other options, but that depends on how the
downstream application is going to read the data. Sensibly, the downstream
application would read it as text.
--
David Biddulph

"Chuck Virtu" wrote in message
...
Dave - close but no cigar. I am not trying to read in the text into a csv
file, I am creating the csv file for a downstream app. The app is either
using EXCEL or other Office product, and is blowing up on the one data
element. I want the CSV file formated by EXCEL so that it understands not
to
try to interpret the data.

Thanks for taking the time to post...

Chuck

"Dave O" wrote:

Hey, Chuck-
This will work, up to a point and after a fashion (or at least until
one of the gurus responds with a better idea): change your CSV file
extension to TXT, and follow the wizard to import the file. When it
comes time to choose a format type, change "General" to "Text" for
columns that contain the E within the text string. This VBA command
worked with the sample data you included in your post (i.e., three
columns of data):

Workbooks.OpenText Filename:="C:\ok2del.txt", Origin:=437,
StartRow:=1, _
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote,
ConsecutiveDelimiter _
:=False, Tab:=False, Semicolon:=False, Comma:=True,
Space:=False, _
Other:=False, FieldInfo:=Array(Array(1, 2), Array(2, 2),
Array(3, 2)), _
TrailingMinusNumbers:=True

The only other idea I can think of is to write VBA code that will open
the CSV file, read each line, and write to cells while formatting E
entries as text. That's chunky but do-able, it just may be more than
the time is worth.

Dave O
Eschew obfuscation