VB.NET VSTO for Outlook Ribbon Tab Not Displaying Properly

39 Views Asked by At

I have a Tab that in on the Outlook Mail Explorer Ribbon. The first tab I've created works flawlessly. The second tab is displayed as a big circular icon with a drop down of the buttons.

If I drop the number of buttons down, it will show properly, but the Ribbon itself shows that there should be plenty of room for a 2 col, 3 row set of buttons.

Here is the Tab when Outlook starts.Closed Tab on Start.

Here is what the Tab looks like when opened. Open Tab

I'm using the Ribbon Designer in VS 2022 Designer View.

The properties are the default properties, nothing changed except the Labels, so that I can track what is what.

A side question to this, how can you set images to be larger than the default in the designer? I see it's possible in Outlook/Office, but haven't seen a way yet.

Thanks for looking at this, and hopefully helping me out.

Searched Bing, Google, used the AI's but all I get is how to display a DropDown, not to prevent one.

I've tried using Separators, ButtonGroups, idividual buttons, but once I go over 2 buttons, it drops down.


Here is the Ribbon.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<customUI onLoad="Ribbon_Load" xmlns="http://schemas.microsoft.com/office/2006/01/customui">
    <ribbon>
        <tabs>
            <tab idMso="TabMail">
                <group id="grpBFE" insertAfterMso="GroupMailNew" label="BFE Utils">
                    <button id="btnAddBFEWork" onAction="btnAddBFEWork_Click" screentip="Add Appointment for BFE Work" label="Add Work" />
                </group>
                <group id="R2NUtilsMail" insertBeforeMso="GroupQuickSteps">
                    <button id="btnCreateRule" label="Create Rule" showImage="false" />
                    <button id="btnCreateRuleFolder" label="Create Rule and Folder" showImage="false" />
                    <separator id="Separator1" />
                    <button id="btnConsolFolders" label="Consolidate Folders" showImage="false" />
                    <button id="btnConsolChildren" label="Consolidate Child Folders" showImage="false" />
                </group>
            </tab>
        </tabs>
    </ribbon>
</customUI>

The Ribbon.vb file

    <Runtime.InteropServices.ComVisible(True)> _
    Public Class Ribbon
        Implements Office.IRibbonExtensibility
    
        Private ribbon As Office.IRibbonUI
    
        Public Sub New()
        End Sub
    
        Public Function GetCustomUI(ByVal ribbonID As String) As String Implements Office.IRibbonExtensibility.GetCustomUI
            Return GetResourceText("RSquaredNerds_Utilities_for_Outlook.Ribbon.xml")
        End Function
    
    #Region "Ribbon Callbacks"
        'Create callback methods here. For more information about adding callback methods, visit https://go.microsoft.com/fwlink/?LinkID=271226
        Public Sub Ribbon_Load(ByVal ribbonUI As Office.IRibbonUI)
            Me.ribbon = ribbonUI
        End Sub
    
    
    
    #End Region
    
    #Region "Helpers"
    
        Private Shared Function GetResourceText(ByVal resourceName As String) As String
            Dim asm As Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly()
            Dim resourceNames() As String = asm.GetManifestResourceNames()
            For i As Integer = 0 To resourceNames.Length - 1
                If String.Compare(resourceName, resourceNames(i), StringComparison.OrdinalIgnoreCase) = 0 Then
                    Using resourceReader As IO.StreamReader = New IO.StreamReader(asm.GetManifestResourceStream(resourceNames(i)))
                        If resourceReader IsNot Nothing Then
                            Return resourceReader.ReadToEnd()
                        End If
                    End Using
                End If
            Next
            Return Nothing
        End Function
    
    #End Region
    
    End Class
2

There are 2 best solutions below

2
Eugene Astafiev On

The very first step I'd recommend is to export all your custom UI generated by the VSTO ribbon designer to the ribbon XML file which you can share there and discuss further. See Export a ribbon from the Ribbon Designer to Ribbon XML for more information.

There are two main ways of creating a custom ribbon UI with VSTO:

  1. The ribbon designer - Walkthrough: Create a custom tab by using the Ribbon Designer.
  2. The ribbon XML - Walkthrough: Create a custom tab by using Ribbon XML.

If you want to sort out such questions it makes sense to take a look at the generated ribbon XML markup first. From your description it is not clear where the problem is.

0
Robert R On

Well, kind of a bone-headed mistake, and finding the answer by just looking at it in another direction!

Depending on the number of additional tabs (I had a FedEx tab added), and removing the Find Time tab (since I never use it), the tab I created stretched out on the Ribbon and completely displayed.

So if this happens to anyone, either make your tab smaller or free up space on the ribbon to allow it to go to full size.