locked
how to open an excel file in windows form application RRS feed

  • Question

  • Hello sir,

              my  code generated  output excel file and i need to open that file with button click  so how do i open that file.

    Regards,

    kavi

    Tuesday, January 6, 2015 9:49 AM

Answers

  • hi,

        my application is in  C++/CLI. with above code i am able to open excel application. but i need to open excel file  in my form with button click as output window.

    like this article :

    http://www.codeproject.com/Articles/15760/How-to-Integrate-Excel-in-a-Windows-Form-Applicati

    Regards,

    kavi

    • Proposed as answer by Pintu Shukla Thursday, January 8, 2015 4:48 PM
    • Marked as answer by Shu 2017 Tuesday, January 13, 2015 10:49 AM
    Thursday, January 8, 2015 4:31 AM

All replies

  • If it is a native application, then consider ShellExecute, specifying the “open” verb and the full path of Excel file.



    • Edited by Viorel_MVP Tuesday, January 6, 2015 10:03 AM
    Tuesday, January 6, 2015 10:00 AM
  • ShellExecute() & ShellExecuteEx() and CreateProcess() is your friend.

    Thanks


    Rupesh Shukla


    Tuesday, January 6, 2015 3:25 PM
  • hello sir,

            is their any tutorial available for reference i am very beginner for windows application programming,

    Regards,

    kavi

    Wednesday, January 7, 2015 3:57 AM
  • Hi kavi,

    From your description, It seem you have a windows form application in C++\CLI, right? If so, please check this article: http://www.codeproject.com/Articles/28083/Use-Visual-Studio-C-CLI-to-Automate-Excel 

    Add refenence of Microsoft::Office::Interop::Excel

    You could find these code in the article:

    #define Excel   Microsoft::Office::Interop::Excel
    ...
    
          Excel::Application^ exApp = gcnew Excel::ApplicationClass();
          //2. Add a workbook (comes with three Worksheets)
          Workbook^   exWb  = exApp->Workbooks->Add(Type::Missing);
                .
                .
                .
          // Show the Workbook
          exApp->Visible = true;

    Best regards,

    Shu Hu


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Shu 2017 Wednesday, January 7, 2015 5:04 AM
    Wednesday, January 7, 2015 5:03 AM
  • hello sir,

            is their any tutorial available for reference i am very beginner for windows application programming,

    Regards,

    kavi

    Hello , I am not sure about your target language . What type of application you have Win32 ,MFC or C# .C++/CLI etc. Second thing you can look inside the MSDN for these function . They contain example as well.

    Thanks


    Rupesh Shukla

    Wednesday, January 7, 2015 3:05 PM
  • There are many ways to do this.  The above suggestions required the Excel installed on the target machine.  Or you could purchase a third party library, which will not require Excel installed on the machine.

    Steve

    Wednesday, January 7, 2015 3:29 PM
  • hi,

        my application is in  C++/CLI. with above code i am able to open excel application. but i need to open excel file  in my form with button click as output window.

    like this article :

    http://www.codeproject.com/Articles/15760/How-to-Integrate-Excel-in-a-Windows-Form-Applicati

    Regards,

    kavi

    • Proposed as answer by Pintu Shukla Thursday, January 8, 2015 4:48 PM
    • Marked as answer by Shu 2017 Tuesday, January 13, 2015 10:49 AM
    Thursday, January 8, 2015 4:31 AM
  • Thanks For your sharing with us such a good 

    • Edited by Gangoriam Thursday, January 8, 2015 4:38 AM
    Thursday, January 8, 2015 4:37 AM