dynamiclly enable disable VSTO ribbon in a powerPoint RRS feed

  • Question

  • I have developed a VSTO ribbon to work with PowerPoint and this ribbon only appears when I open PowerPoint via another windows application. If user open PowerPoint alone, I have hide the ribbon (I’m using name pipe mechanism to communicate PowerPoint and my windows application). Even this work fine, sometimes I have to kill the PowerPoint process to apply this function (scenario : I open PowerPoint with application so the ribbon appears . then I close both PP and windows application and re open power point alone .Then still the ribbon appears. Then I go to task manger and kill the power point then. Then ribbon is hide)

    I have written the call “client part” of name pipe communicator on “Ribbon_Load” of VSTO.  How do I solve this issue?


    Wednesday, August 14, 2013 11:27 AM

All replies

  • Hi,

    In the Ribbon_Load, better check for the condition to load the Ribbon and if it falis use the following code.

      for (int i = 0; i < this.Ribbon.Tabs.Count; i++)
          this.Ribbon.Tabs[0].Visible = false;

    Tuesday, August 27, 2013 8:57 AM
  • Hi gayan

    For better understanding: You've created a VSTO Add-in for PowerPoint, and this add-in should load when your application starts PowerPoint, but not when the user starts PowerPoint as a standalone?

    Perhaps the best approach would be to load your add-in only when your windows application starts PowerPoint, and to unload it when your windows application terminates.

    Your VSTO Add-in should appear in the list of COM Add-ins and can manually be removed/activated via the checkbox in the COM Add-ins dialog box. This corresponds to the Application.COMAddins collection, which has a Connect property for each Item in the collection. Setting Connect = True will load the Add-in; setting it to false will unload the add-in.

    All you need to do is make sure your add-in is registered to load on demand rather than automatically when PowerPoint starts.

    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, August 28, 2013 5:50 AM

  • try this

    foreach (var group in this.RibbonName.Groups)
        foreach (var item in group.Items)
            item.Enabled = false;

    Thursday, September 26, 2013 7:32 PM