none
Running Office 2010 APPS from CODE in C# - Bug when running EXCE: RRS feed

  • Question

  • Hello , 

    I've found one strange behaviour when running office Apps using VSTO from code . I have a console application that launches Office app and then closes itself and I need to keep the office app opened. I have no problem when I'm running word app : 

     

    var app = new Microsoft.Office.Interop.Word.Application();
            app.Visible = true;
            app = null;

    Problems start when executing Excel with the same code : 

       

    var app = new Microsoft.Office.Interop.Excel.Application();
            app.Visible = true;
            app = null;

    This is when the strange things starts to happen. When the console application that started Excel app closes , the Excel closes too . Any suggestions how to keep it opened without the need of the Console application to be running ? 

    Thanks

    Wednesday, April 11, 2012 7:24 AM

Answers

  • Ok i've found a workaround 

                var app = new Microsoft.Office.Interop.Excel.Application();
                app.Workbooks.Add(); 
                app.Visible = true;
                app = null;

    This keeps excel running . 

    Wednesday, April 11, 2012 9:00 AM

All replies