Ribbon/VBA errors - where to see them?

jjasmith4

Board Regular
Joined
Aug 22, 2018
Messages
52
I have a ribbon with a button and a label: the button opens up a data-entry form, and the label is supposed to show the environment. As I'm designing the ribbon XML everything's find until I add the attribute getLabel="modRibbon.GetEnvironment" to the <labelControl> element. Here are the ribbon XML and the whole VBA module named modRibbon.

When I leave out getLabel="modRibbon.GetEnvironment", all is well: the ribbon displays, the button works, and the label shows "Env". When I put it back in, the ribbon doesn't even display, and there's absolutely no clue anywhere as to what could possible be wrong, which is nothing whatsoever! I have followed all documentation scrupulously, and I have spent hours boiling it down to this one attribute, which, for no reason at all is the difference between the ribbon displaying and the ribbon not displaying.

What in hell could possibly possibly be wrong here? And where can I see any error messages?

XML:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="modRibbon.RibbonLoaded">
    <ribbon startFromScratch="false">
        <tabs>
            <tab id="customTab" label="Deals">
                <group id="customGroup" label="Maintenance">
                    <button id="customButton" label="Open" imageMso="CreateReportFromWizard" size="large" onAction="modRibbon.Start" />
                    <labelControl id="customLabel" label="Env" getLabel="modRibbon.GetEnvironment" />
                </group>
            </tab>
        </tabs>
    </ribbon>
</customUI>

Here's modRibbon:
VBA Code:
Option Explicit
Option Private Module

Public Const ENV As String = "DEV"

Public myRibbon As IRibbonUI

Public Sub RibbonLoaded(ribbon As IRibbonUI)   'Callback for customUI.onLoad
    Set myRibbon = ribbon
End Sub

Public Sub Start(control As IRibbonControl)    'Callback to load main form
    frmMain.Show
End Sub

Public Sub GetEnvironment(control As IRibbonControl, ByRef label)    'Callback to supply the environment string
    label = ENV
End Sub
 

Some videos you may like

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,422
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Have you checked the option to 'Show add-in user interface errors' in Excel Options?

Also, I note you have both a label and a getLabel attribute... :)
 
Solution

jjasmith4

Board Regular
Joined
Aug 22, 2018
Messages
52
Have you checked the option to 'Show add-in user interface errors' in Excel Options?

Also, I note you have both a label and a getLabel attribute... :)
label indicates the initial text; getLabel indicates the callback that generates the label.
Are you saying you must specify only one, but not the other?
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
36,422
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
Yes. Label is static, getLabel dynamic, and it can’t be both.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,098
Messages
5,622,685
Members
415,920
Latest member
ExcelNoob28

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top