locked
How to intergrate MS excel with Visual studio? RRS feed

  • Question

  • Hi friend,

    This might be the wrong place to publish this post but there are so many forums to browse through :) ........

    I was told that if i have VSTS 2008 i could intergrate VS with MS Excel. so i could use this has a Project Management tool?

    I use VSTS 2008 and MS Office Enterprise 2007.... 

    I dont have Team Foundation Server install in my work machine....., 

    How do i intergrate Excel with VSTS?

    thanks 

     

     

    Sunday, December 6, 2009 4:18 PM

Answers

  • Hello,

    I think you are looking for the method to automate excel under Visual Studio. If yes, first Office 2007 PIA should be installed. You could download this from Microsoft Download Center: http://www.microsoft.com/downloads/details.aspx?FamilyID=59daebaa-bed4-4282-a28c-b864d8bfa513&displaylang=en.

    Second, in the windows form project/Console project, add a reference to Microsoft Excel 12.0 Object Library on Com tab.

    Third, use excel object model. Please refer to this MSDN page: http://msdn.microsoft.com/en-us/library/bb149081.aspx.
                using Excel = Microsoft.Office.Interop.Excel;     
             
                Excel.Application objExcel = new Excel.Application();
                objExcel.Visible = true;
                object missing = Type.Missing;
                Excel.Workbook wk = objExcel.Workbooks.Open(@"C:\Test.xls", missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing);
               ...
               (objExcel as Excel._Application).Quit();
               Marshal.ReleaseComObject(objExcel); //release this com object

    If you have any further question for this, please point me out. Or If I have mistaken this scenario, please try the link posted by DeborahK.

    Best regards,
    Bessie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Harry Zhu Tuesday, December 22, 2009 8:53 AM
    Thursday, December 10, 2009 10:43 AM

All replies

  • You may have better luck posting your question here:

    http://social.msdn.microsoft.com/Forums/en-US/category/vsts

    Hope this helps.
    www.insteptech.com ; msmvps.com/blogs/deborahk
    We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
    Monday, December 7, 2009 3:33 AM
  • Hello,

    I think you are looking for the method to automate excel under Visual Studio. If yes, first Office 2007 PIA should be installed. You could download this from Microsoft Download Center: http://www.microsoft.com/downloads/details.aspx?FamilyID=59daebaa-bed4-4282-a28c-b864d8bfa513&displaylang=en.

    Second, in the windows form project/Console project, add a reference to Microsoft Excel 12.0 Object Library on Com tab.

    Third, use excel object model. Please refer to this MSDN page: http://msdn.microsoft.com/en-us/library/bb149081.aspx.
                using Excel = Microsoft.Office.Interop.Excel;     
             
                Excel.Application objExcel = new Excel.Application();
                objExcel.Visible = true;
                object missing = Type.Missing;
                Excel.Workbook wk = objExcel.Workbooks.Open(@"C:\Test.xls", missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing);
               ...
               (objExcel as Excel._Application).Quit();
               Marshal.ReleaseComObject(objExcel); //release this com object

    If you have any further question for this, please point me out. Or If I have mistaken this scenario, please try the link posted by DeborahK.

    Best regards,
    Bessie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Harry Zhu Tuesday, December 22, 2009 8:53 AM
    Thursday, December 10, 2009 10:43 AM