Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default CSV formatted text file to Excel

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
  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 27,285
Default CSV formatted text file to Excel

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



  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default CSV formatted text file to Excel

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

  #4   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CSV file doesn't save "xEy" style number as text formatted data [email protected] Excel Discussion (Misc queries) 1 July 30th 08 06:03 PM
Converting formatted text into a txt file Marc Excel Discussion (Misc queries) 1 June 21st 07 04:00 PM
Reading in poorly formatted text file Some Dude Excel Discussion (Misc queries) 1 February 11th 07 10:24 PM
Converting 'General' formatted cells to Text formatted cell using. Zahid Khan Excel Worksheet Functions 1 March 12th 05 07:13 PM
Creating properly formatted text file from vbscript using excel data msnews.microsoft.com[_7_] Excel Programming 2 December 18th 03 09:33 PM


All times are GMT +1. The time now is 07:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"