1

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">
4

1 回答 1

2

试试这个功能区组的标记:

&lt;group id="rxGrp_DeveloperTools" label="Developer Tools" getVisible="rxGrp_DeveloperTools_GetVisible"&gt;

然后使用像这样的子来显示/隐藏组:

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
于 2013-11-23T16:37:40.203 回答