CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2003
    Location
    Athens
    Posts
    231

    Newbie Qusetion: How can i send results to Excel?

    Hi Guys,

    I am fairly new to prgramming MFC and i was just wandering if anyone knew/if its possible to send results from my app to excel.
    I am running an app that gives different numbers as a result and i want to send this to excel so i can sort through the results but don't know how?

  2. #2
    Join Date
    Feb 2002
    Posts
    3,788

    Re: Newbie Qusetion: How can i send results to Excel?

    Originally posted by Ankoump
    Hi Guys,

    I am fairly new to prgramming MFC and i was just wandering if anyone knew/if its possible to send results from my app to excel.
    I am running an app that gives different numbers as a result and i want to send this to excel so i can sort through the results but don't know how?
    justy search this site for "excel automation". you'll get plenty of results

  3. #3
    Join Date
    Oct 2003
    Location
    Athens
    Posts
    231
    Do I really need to go in the automation process. I mean when I did console programming, all you need was to write to a .csv file and use the fout<< statement to send it there….

    Is there no simlar way in MFC, I have searched but there is no relating answer..

  4. #4
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637
    ODBC can write to Excel too.

  5. #5
    Join Date
    Aug 2001
    Location
    Texas
    Posts
    645
    A CSV file is a type of Excel file. You can use it if you only write.
    CSV is still available for MFC.

    If you need to write to an XLS or do read/write, you will need
    to use automation or ODBC.

    Automation is simple (but tedious)

    Did you think that because you were using MFC you couldn't use
    the CSV file???

  6. #6
    Join Date
    Apr 2003
    Location
    UK
    Posts
    83
    Use CStdioFile::WriteLine to generate a csv file, then launch the file in Excel with this:

    Code:
    ::ShellExecute(m_hWnd, _T("open"), strFileName, NULL, NULL, SW_SHOW);
    where strFileName is the name of the csv file. This will use the association of the csv extension with Excel to open the file in Excel.

    This is a one way flow of data from your app to Excel. If you need anything more sophisticated, then Automation is your best bet.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured