View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default CSV formatted text file to Excel

Turn on the macro recorder (tools=Macro=Record a New Macro) and do it
manually in excel. That will give you the objects you need to use. I
don't know C++, so beyond that you will have to figure out how to call them.

--
Regards,
Tom Ogilvy


Sobhan wrote in message
m...
Reason is that I want to write an automated application without doung
it manually.Could you help?

"Tom Ogilvy" wrote in message

...
Excel will do what you want just by opening the file in excel. Then you

can
just access the first column.

Not sure why you want to preprocess it VC++

in Excel, do file=Open, select the CSV file and click OK.

You will see it parsed into separate columns in Excel.

--
Regards,
Tom Ogilvy


Sobhan wrote in message
om...
Hi all,
I am writing a small VC++ application of how to import the CSV
formatted
.txt file to excel. I am facing problem while parsing the text file.

"TicketNo","CarNo","PersonAge"
12534 , 763534 , 23
12345 , 624333, 24

The problem is in MFC there is a SetValue2(CoeVariant:column data)
method in which if i will pass an array(12534) then it will be
imported to excel.For example IfI will search for the "employee
number" field in text file then the values passed to SetValue2()should
be 12543 and 12345.But Using C++ I cannot do so as I have to read the
values rowwise(record by record) from the text file.I tried to return
a vector(to return integer values-12345).But I got 80 errors as
probably VC++ -6.0 is not compatible to the same.
1.My Main problem is how to extract values for "TicketNo"--12534 and
12345 from the text file to my application.
2.How to skip the header after reading the same?
3.Do I have to use some other method of MFC? Does anybody know there
exists a
AfxExtractSubstring() function in MFC.As I tried to search in MSDN but
couldnot got it?
Do anybody have sample source code for the particular application then
it may prove helpful for me?

Bubunia