0

I have a custom group within the ribbon menu. In classic and simplified explorer view I want to place my group after groups and before find groups, I mean, between groups and find groups. See screenshots. How can I do this?

Classic view: enter image description here

Simplified view: enter image description here

I have tried below:

  <ribbon>
    <tabs>
      <tab idMso="TabMail">
        <group id="MyGroupHome" 
               insertBeforeMso="GroupFind"

But it does not work. How can I make my group always visible in all views classic and simplified and even in full screen or not full screen?

UPDATE: Using insertBeforeMso="GroupContactFind" is working on full screen but when not in full screen (you click on minimize button of the window) then it is only working in classic view but not in simplified view. What's happening?

UPDATE 2: If I left click on my group in the ribbon, then a context menu appear and there is an option that says "Pin to ribbon", If I select it, then my group is always visible in the ribbon, just what I want, but how to do it programmatically?

enter image description here

Willy
  • 9,848
  • 22
  • 141
  • 284
  • What controls do you add to the custom group? Could you show the full ribbon XML markup? – Eugene Astafiev Jul 19 '22 at 12:26
  • @EugeneAstafiev Basically it is an split button within a group. Please see my update 2. I would like to know how can I pin it to ribbon programmatically, the same you do from the context menu option "Pin to ribbon" (see new screenshot in update 2) – Willy Jul 19 '22 at 12:51
  • The Ribbon UI doesn't provide any API for that. You can play with methods like `CommandBars.ExecuteMso`, but there is no trivial way to get the job done. – Eugene Astafiev Jul 19 '22 at 13:11
  • Answers are getting irrelevant when you edit your questions. Please stop doing that and consider posting new questions in a separate thread, so end users could easily recognize questions and answers. – Eugene Astafiev Jul 19 '22 at 13:27

1 Answers1

1

Most probably you get an error at runtime and Office hides your customizations automatically. For example, when there is no such MsoId on the ribbon UI you will not get custom UI displayed. So, to track such situations I always recommend enabling UI errors in the host application when developing add-ins.

By default, if a VSTO Add-in attempts to manipulate the Microsoft Office user interface (UI) and fails, no error message is displayed. However, you can configure Microsoft Office applications to display messages for errors that relate to the UI. You can use these messages to help determine why a custom ribbon does not appear, or why a ribbon appears but no controls appear.

To show VSTO Add-in user interface errors

  1. Start the application.
  2. Click the File tab.
  3. Click Options.
  4. In the categories pane, click Advanced.
  5. In the details pane, select Show VSTO Add-in user interface errors, and then click OK.

For Outlook, the Show VSTO Add-in user interface errors checkbox is located in the Developer section of the details pane. For other applications, the checkbox is located in the General section of the details pane.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • but my group is shown correctly, it only disappears in simplified view and if you minimize window. I have found a solution, see my updated post, update 2, if I click on my group in the ribbon menu, then from context menu there is an option called "Pin to ribbon", If I select it, then my group never disappears, but how to do it programmatically? – Willy Jul 19 '22 at 12:31
  • The Fluent UI (aka Ribbon UI) doesn't provide anything for pinning controls. You may find a similar [VBA auto hide ribbon in Excel 2013](https://stackoverflow.com/questions/39201757/vba-auto-hide-ribbon-in-excel-2013) thread helpful. – Eugene Astafiev Jul 19 '22 at 13:09