none
Word in Explorer,Ribbon control freezes/disable if i open word document normally from MS word. RRS feed

  • Question

  • Hello,

    Currently i am hosting word document in Internet explorer, In task manger it create one word instance.Now i am trying to open another new/old word document normally then It's not creating another instance, it opens in first word instance (so i have two word documents with one word instance). After opening my second word document normally i navigated to first word document which is hosted in internet explorer. now here the ribbon control getting freeze/disable i can't able to select any option from ribbon control. but in the second normal word we can able to access ribbon control. i looked into several " HKEY_CLASSES_ROOT\Word.Document.12\shell\Open\command " registry modifications but nothing works. any suggestion pls, i am struggling from a week.

    Word : 2007 , Windows 7 Environment.

    Thanks,

    Ravindra.

    Tuesday, May 19, 2015 2:32 PM

All replies

  • Hello Ravindra,

    What code do you use for opening a Word document in Internet Explorer? Could you be more specific?

    Tuesday, May 19, 2015 6:02 PM
  • Hi Eugene,

    I am using the below code to open word document in Internet Explorer by using axWebBrowser control

    _App = new Microsoft.Office.Interop.Word.Application();
                    _App.Visible = false;
                    _wordDocument = _App.Documents.Add(ref objMissing, ref objMissing, ref objMissing, ref objMissing);
                    _App.DisplayAlerts = WdAlertLevel.wdAlertsNone;
        var docPath = @"C:\blnkltr.doc";
    axWordWebBrowserCntrl.Navigate(docPath);
      _wordDocument = (Document) axWordWebBrowserCntrl.Document;

    So i can able to open it in Internet Explorer. So now i am going to open normal word document. so in task manger it's opening in same instance of existing word (It's not creating new instance for it, i don't know why). Now if i moved to Internet explorer word document the ribbon control getting freeze/disable. Any help would be appreciated. 

    Thanks, 

    Ravindra. 

    Wednesday, May 20, 2015 9:17 AM
  • Ravindra,

    By default a new document is opened in a single (existing) Word process. If you want to get a separate process running you need to specify the /n command line argument. See How to use startup command-line switches to start Word 2010, Word 2007, Word 2003, Word 2002, and Word 2000 for more information.

    Try to use any third-party components for rendering Word files on client's PCs. Word may not be installed on all users' machines.

    Wednesday, May 20, 2015 1:25 PM
  • Thanks Eugene for reply,

    Seems it wont solve my problem i need to handle this by programmatic. Even the approach is lot different because i am hosting a document in Internet explorer. Is there any way to rename my process in taskmanger while creating my word application object like ... App = new Microsoft.Office.Interop.Word.Application();

    or any other hack to stop interacting the other word instances with my word instance in taskmanger.

    Thanks,

    Ravindra

    Wednesday, May 20, 2015 3:01 PM
  • Hi Ravindra

    If your application is opening another document, then it should be possible for you to start a new instance of the Word application in which to open it. Just use the same method:

    _AppNewInstance = new Microsoft.Office.Interop.Word.Application();

    A bigger problem is when you have to allow for users opening documents or starting an instance of Word. See, for instance, this KB article

    https://support.microsoft.com/en-us/kb/188546?wa=wsignin1.0

    There are also other ways to start new instances of an Office application, which may or may not be relevant:

    http://blogs.msdn.com/b/andreww/archive/2008/11/30/starting-or-connecting-to-office-apps.aspx


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, May 20, 2015 5:48 PM
    Moderator
  • Additional consideration:

    You can also control how Word starts via a Registry setting. The Registry basically uses the same command line switches as Eugene refers to. It is possible to change the Registry entry for Word to ALWAYS start a new instance, but this could be a tricky proposition and I only mention it for the sake of completeness.


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, May 20, 2015 5:50 PM
    Moderator
  • Hello Ravindra,

    You can create as many Word Application instances as you need. For example:

    AppInstance1 = new Microsoft.Office.Interop.Word.Application();
    AppInstance2 = new Microsoft.Office.Interop.Word.Application();

    Wednesday, May 20, 2015 8:55 PM
  • Hi Cindy,

    Thanks for your suggestion, Can you please provide any link to open word in different instances by changing the Word registry key values. 

    Thanks,

    Ravindra.

    Thursday, May 21, 2015 9:22 AM
  • Hi Ravindra

    Working with an application's Registry settings is more a topic for IT Pro (System Admins), which is covered in the TechNet set of forums. That would be the place to find out exactly which entries in the Registry do what.

    The article Eugene provides a link to tells you what switches affect what kind of behavior.

    Whether or not your code can make a change to the default of a Registry will depend on the security settings in the environment in which its executing and what permissions your code execution has - it's possible your code won't be allowed to make such changes. So before you dig into this too deeply you want to make sure you'll be allowed to do what you want to do. And it would certainly be better if the System Admin could handle this through a group policy (again, a topic for the TechNet forums) rather than making the change in your code.

    An example, for Word 2010 running on Win 7:

    HKEY\LocalMachine\Software\Classes\Applications\Winword.exe\shell\edit\command

    The default value: "C:\Program Files\Microsoft Office\Office14\WINWORD.EXE" /n "%1"


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, May 21, 2015 4:42 PM
    Moderator