I have created a Ribbonbar for Excel, where the labels for the various controls are programmatically generated in the VBA. This is done so that we can have the ribbonbar in different languages depending on the users settings.
If I open Excel, click on our tab the ribbon bar displays and functions with no problems, but ...
If I open up Excel, click on the "Office Button", Click on "Excel Options", click on Customize, and then using "Choose commands from" select my ribbonbar Tab, I get error boxes that are completely blank! And as many of them as there are controls in the ribbon bar.
Can anyone tell me how to stop these errors?
regards
John
The code we are using is as follows:
This is the xml I am using:
And the VBA:
If I open Excel, click on our tab the ribbon bar displays and functions with no problems, but ...
If I open up Excel, click on the "Office Button", Click on "Excel Options", click on Customize, and then using "Choose commands from" select my ribbonbar Tab, I get error boxes that are completely blank! And as many of them as there are controls in the ribbon bar.
Can anyone tell me how to stop these errors?
regards
John
The code we are using is as follows:
This is the xml I am using:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<customUI xmlns="[URL unfurl="true"]http://schemas.microsoft.com/office/2006/01/customui"[/URL] loadImage="LoadImage" onLoad="ribbonLoaded" >
<ribbon startFromScratch="false">
<tabs>
<tab id="tab1" getLabel="MY_getTab" keytip="z" >
<group id="group1" getLabel="MY_getlabel">
<button id="button1" getLabel="MY_getlabel" />
<button id="button2" getLabel="MY_getlabel" />
</group>
<group id="group2" getLabel="MY_getlabel">
<button id="button3" getLabel="MY_getlabel" />
<button id="button4" getLabel="MY_getlabel" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
And the VBA:
Code:
Global moRibbon As IRibbonUI
Dim a As Integer
Sub ribbonLoaded(ByRef ribbon As IRibbonUI)
Set myRibbon = ribbon
End Sub
Sub MY_getTab(control As IRibbonControl, ByRef label)
Dim myCommand As String
myCommand = control.ID
label = "Test Tab"
End Sub
Sub MY_getlabel(control As IRibbonControl, ByRef label)
Dim myCommand As String
Dim myLabel As String
myCommand = control.ID
If myCommand = "group1" Then
myLabel = "Group 1"
ElseIf myCommand = "group2" Then
myLabel = "Group 2"
ElseIf myCommand = "button1" Then
myLabel = "Button 1"
ElseIf myCommand = "button2" Then
myLabel = "Button 2"
ElseIf myCommand = "button3" Then
myLabel = "Button 3"
ElseIf myCommand = "button4" Then
myLabel = "Button 4"
End If
label = myLabel
End Sub