I have an excel addin that has a bunch of buttons and functions in it. Part of this is a togglebutton on the ribbon that i would like to use to change a pivot table to use dollars versus hours as the displayed values...
I would like the items to change between a bank icon and a clock icon.
I have the ribbonUI defined as below (i only have the toggle button here, there's a lot more):
I have loaded the images into the ribbon as far as i can tell...
(note: i changed the xml to use image="bank" and it shows fine, but i can't toggle it that way- i just did this to see if it was loaded)
I then am using a named range in the worksheet within the addin and the getImageHoursDollars is:
The image however never displays (though "Setting image to display bank" or "...hours" does work fine...
ALSO, the caption and supertip never display either...
I would like the items to change between a bank icon and a clock icon.
I have the ribbonUI defined as below (i only have the toggle button here, there's a lot more):
VBA Code:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" >
<ribbon startFromScratch="false">
<tabs>
<tab id="customTab" label="Checkbox Tab" insertBeforeMso="TabHome" getVisible="RibbonVisible">
<group id="GroupAdditionalButtons" label="Filter Functions">
<toggleButton id="buttonToggleHoursDollars" getImage="getImageHoursDollars" onAction="ToggleHoursDollars"
getScreentip="GetScreentipHoursDollars" getSupertip="getSupertipHoursDollars" size="large" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
I have loaded the images into the ribbon as far as i can tell...
I then am using a named range in the worksheet within the addin and the getImageHoursDollars is:
VBA Code:
Sub getImageHoursDollars(control As IRibbonControl, ByRef returnedVal)
Dim PivotDataWS As Worksheet, R As Range
Set PivotDataWS = ThisWorkbook.Worksheets("PivotFilters")
Set R = f_CellRef("HoursOrDollars", PivotDataWS)
If R = "Hours" Then
returnedVal = "clock"
Else
R = "bank"
End If
MsgBox "Setting image to display " & R
End Sub
The image however never displays (though "Setting image to display bank" or "...hours" does work fine...
ALSO, the caption and supertip never display either...
VBA Code:
'Callback for buttonToggleHoursDollars getScreentip
Sub GetScreentipHoursDollars(control As IRibbonControl, ByRef returnedVal)
Dim PivotDataWS As Worksheet, R As Range
Set PivotDataWS = ThisWorkbook.Worksheets("PivotFilters")
Set R = f_CellRef("HoursOrDollars", PivotDataWS)
If R = "Hours" Then
R = "Display in dollars"
Else
R = "Display in hours"
End If
End Sub