none
Launch Word without loading add-ins using C# RRS feed

  • Question

  • Hi,

    I am using VS 2010 and Word 2010. I have added reference to Office.Interop to my C# project.

    I am successfully able to launch Word from C# code however when Word starts it loads all the add-in (Word + COM) in the session. From command line I can start Word as winword /a  and this will start Word without any add-ins.

    How can I do this via code.I don't want to remove the add-ins after the application is started, I want to start Word without loading any of the add-ins.

    Any help is much appreciated!!

    Thanks.

    Thursday, July 5, 2012 10:12 PM

Answers

  • do not use classes from Office.Interop to start your process, use simple System.Diagnostics.Process.Start and pass path to office app with proper command line arguments that will make add-in not load. Then use Marshal.GetActiveObject to obtain reference to office app and cast ti to proper interface from Office.Interop. Everything later is the same.
    Friday, July 6, 2012 7:16 AM
  • Hi Pranav

    The Process.Start method uses command line to start the Office application. For more information see
    http://answers.microsoft.com/en-us/office/forum/word


    Cindy Meister, VSTO/Word MVP

    Friday, July 6, 2012 7:50 AM
    Moderator

All replies

  • do not use classes from Office.Interop to start your process, use simple System.Diagnostics.Process.Start and pass path to office app with proper command line arguments that will make add-in not load. Then use Marshal.GetActiveObject to obtain reference to office app and cast ti to proper interface from Office.Interop. Everything later is the same.
    Friday, July 6, 2012 7:16 AM
  • Hi Pranav

    The Process.Start method uses command line to start the Office application. For more information see
    http://answers.microsoft.com/en-us/office/forum/word


    Cindy Meister, VSTO/Word MVP

    Friday, July 6, 2012 7:50 AM
    Moderator