N
N. L. Devotie
I have the most basic tab created for the Excel 2007 ribbon, xml at end along
with VBA
After Excel starts, if I click my tab, my button is enabled and it works.
After that, regardless of the state my current cell is in if I go back to my
tab, my button is still enabled.
However, if when I start Excel I immediately enter something into cell A1,
then while still in edit mode I click my tab on the ribbon, I get a beep, and
my button is not enabled. Furthermore, it will never become enabled short of
disabling my add-in and reloading, or restarted Excel.
Interestingly enough, if I removed the getEnabled callback, it works fine.
However, if fails in the same way if I try to use a GetLabel callback.
Obviously, the problem is moot if the user is not in edit mode when he
clicks my tab. However, I can't control that. What can I do to restore my
tab to functioning if and when this situation occurs?
Ribbon XML:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab id="myTab" label="ThisTab" >
<group id="grp1" label="grp1" >
<button id="btn1" label="btn1Label"
getEnabled="btn1Enabled" onAction="btn1CB"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
VBA from my xlam file, Module1:
Option Explicit
Private Sub Btn1CB(control As IRibbonControl)
MsgBox "Btn1CB"
End Sub
Private Sub btn1Enabled(control As IRibbonControl, ByRef returnedVal)
returnedVal = 1
End Sub
with VBA
After Excel starts, if I click my tab, my button is enabled and it works.
After that, regardless of the state my current cell is in if I go back to my
tab, my button is still enabled.
However, if when I start Excel I immediately enter something into cell A1,
then while still in edit mode I click my tab on the ribbon, I get a beep, and
my button is not enabled. Furthermore, it will never become enabled short of
disabling my add-in and reloading, or restarted Excel.
Interestingly enough, if I removed the getEnabled callback, it works fine.
However, if fails in the same way if I try to use a GetLabel callback.
Obviously, the problem is moot if the user is not in edit mode when he
clicks my tab. However, I can't control that. What can I do to restore my
tab to functioning if and when this situation occurs?
Ribbon XML:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<tabs>
<tab id="myTab" label="ThisTab" >
<group id="grp1" label="grp1" >
<button id="btn1" label="btn1Label"
getEnabled="btn1Enabled" onAction="btn1CB"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
VBA from my xlam file, Module1:
Option Explicit
Private Sub Btn1CB(control As IRibbonControl)
MsgBox "Btn1CB"
End Sub
Private Sub btn1Enabled(control As IRibbonControl, ByRef returnedVal)
returnedVal = 1
End Sub