B
basso profondo
Hi folks, Looking for help on this.
If we embed a button inside an excel 2007 ribbon gallery, it is not possible
to change its "Enabled" state after a workbook is opened and the gallery is
expanded. Only on workbook open the "getEnabled" callback is successfully
executed and the proper state is achieved. Following workbook open as well,
before the gallery is expanded, the state changes successfully. However once
the gallery is expanded the state cannot be changed.
Buttons that are not embedded in a gallery work just fine.
can be definitely seen on SP0 and SP2.
the xml file to customize the
ribbon:---------------------------------------------------------------------------------------------------------------
<!--
Here we have added a button and a gallery containing a button in the Home
tab of the excel ribbon.
We have grouped them under the "Enable Issue" group.
The two buttons "Will Change" and "Won't Change" both have the same
callback corresponding to the "getEnabled" property.
-->
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI onLoad="ribbonLoaded"
xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab idMso="TabHome" >
<group id="RDBGroup2" label="Enable Issue" >
<gallery id="IssueGallery" imageMso="DateAndTimeInsert"
label="Expand Me" columns="3" rows="4" onAction="InsertMonth" >
<button id="Disobedient" label="Won't Change"
getEnabled="GetEnabled" />
</gallery>
<button id="Obedient" label="Will Change"
getEnabled="GetEnabled" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
The VBA code that calls ribbon.invalidate
Option Explicit
Dim Rib As IRibbonUI
Public Enabled As Boolean
'Callback for customUI.onLoad
Sub ribbonLoaded(ribbon As IRibbonUI)
Set Rib = ribbon
End Sub
Sub GetEnabled(control As IRibbonControl, ByRef returnedVal)
returnedVal = Enabled
End Sub
Sub Set_Enabled()
Enabled = True
Rib.Invalidate
End Sub
Sub Set_Disabled()
Enabled = False
Rib.Invalidate
End Sub
If we embed a button inside an excel 2007 ribbon gallery, it is not possible
to change its "Enabled" state after a workbook is opened and the gallery is
expanded. Only on workbook open the "getEnabled" callback is successfully
executed and the proper state is achieved. Following workbook open as well,
before the gallery is expanded, the state changes successfully. However once
the gallery is expanded the state cannot be changed.
Buttons that are not embedded in a gallery work just fine.
can be definitely seen on SP0 and SP2.
the xml file to customize the
ribbon:---------------------------------------------------------------------------------------------------------------
<!--
Here we have added a button and a gallery containing a button in the Home
tab of the excel ribbon.
We have grouped them under the "Enable Issue" group.
The two buttons "Will Change" and "Won't Change" both have the same
callback corresponding to the "getEnabled" property.
-->
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<customUI onLoad="ribbonLoaded"
xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab idMso="TabHome" >
<group id="RDBGroup2" label="Enable Issue" >
<gallery id="IssueGallery" imageMso="DateAndTimeInsert"
label="Expand Me" columns="3" rows="4" onAction="InsertMonth" >
<button id="Disobedient" label="Won't Change"
getEnabled="GetEnabled" />
</gallery>
<button id="Obedient" label="Will Change"
getEnabled="GetEnabled" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
The VBA code that calls ribbon.invalidate
Option Explicit
Dim Rib As IRibbonUI
Public Enabled As Boolean
'Callback for customUI.onLoad
Sub ribbonLoaded(ribbon As IRibbonUI)
Set Rib = ribbon
End Sub
Sub GetEnabled(control As IRibbonControl, ByRef returnedVal)
returnedVal = Enabled
End Sub
Sub Set_Enabled()
Enabled = True
Rib.Invalidate
End Sub
Sub Set_Disabled()
Enabled = False
Rib.Invalidate
End Sub