Reputation: 84
I have a simple Ribbon with a few groups in it.
I need to modify this ribbon through VBA to toggle visibility on the groups that I have in the Ribbon. Let's say Range("A1") has "A" as the cell value; then this group would be visible. If it's empty then it will be hidden.
Here is the XML for that Ribbon, the group I need to toggle is:
<group id="rxGrp_DeveloperTools" label="Developer Tools">
Upvotes: 1
Views: 114
Reputation: 401
Try this markup for the ribbon group:
<group id="rxGrp_DeveloperTools" label="Developer Tools" getVisible="rxGrp_DeveloperTools_GetVisible">
Then use a sub like this one to show/hide the group:
Sub rxGrp_DeveloperTools_GetVisible(control As IRibbonControl, ByRef bVisible)
Dim sht as Worksheet
Set sht = ActiveWorkbook.Sheets(1)
If sht.Range("A1").Value = "A" Then
bVisible = True
Else
bVisible = False
End If
End Sub
Upvotes: 2