Ribbon/VBA errors - where to see them?

jjasmith4

Board Regular
Joined
Aug 22, 2018
Messages
59
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
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
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... :)
 
Upvote 0
Solution
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?
 
Upvote 0
Yes. Label is static, getLabel dynamic, and it can’t be both.
 
Upvote 0

Forum statistics

Threads
1,212,927
Messages
6,110,708
Members
448,293
Latest member
jin kazuya

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
Back
Top