W
Walt
Hi,
Some controls are disabled when a worksheet is protected (ex.
Spelling). If I want to allow the user to do a spelling check via a
repurposed spelling control (Unprotect/Spell ck./Protect), I find I
can't enable the control in my attempts so far. There seems to be no
way to override the Excel disabling of the Ribbon control.
I've tested with the code below in a workbook with one of the three
worksheets protected. I've also tested with
Workbook_SheetSelectionChange vs. Workbook_SheetActivate thinking it
might be a matter of sequencing, but to no avail.
**********RIBBONX CODE*******************************************
<customUI onLoad="RibbonObj" xmlns="http://schemas.microsoft.com/
office/2006/01/customui">
<commands>
<command idMso="Spelling" onAction="TestRepurpose"
getEnabled="GetEnabled" />
</commands>
</customUI>
**********THISWORKBOOK CODE*******************************************
Private Sub Workbook_Open()
TF = True
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If TF Then 'TOGGLE TF
TF = False
Else
TF = True
End If
Call RibbonReload
End Sub
**********STANDARD MODULE
CODE*******************************************
Public TF As Boolean
Dim Rib As IRibbonUI
Sub RibbonObj(ribbon As IRibbonUI)
Set Rib = ribbon
End Sub
Sub RibbonReload()
If Not Rib Is Nothing Then
Rib.Invalidate
Else
MsgBox "Rib is lost"
End If
End Sub
Sub TestRepurpose(ByRef Control As IRibbonControl, ByRef Pressed As
Variant)
MsgBox "Repurposed"
End Sub
Sub GetEnabled(ByRef Control As IRibbonControl, ByRef ReturnValue As
Variant)
ReturnValue = TF
End Sub
This is the same issue as in :
http://groups.google.com/group/micr...cc11e?hl=en&lnk=gst&q=enable#8487ca2b6b6cc11e
but with the Ribbon vs. Command Bar control.
Has anyone found a way to do this?
Best Regards,
Walt
WIN XP sp2, Excel 2007
Some controls are disabled when a worksheet is protected (ex.
Spelling). If I want to allow the user to do a spelling check via a
repurposed spelling control (Unprotect/Spell ck./Protect), I find I
can't enable the control in my attempts so far. There seems to be no
way to override the Excel disabling of the Ribbon control.
I've tested with the code below in a workbook with one of the three
worksheets protected. I've also tested with
Workbook_SheetSelectionChange vs. Workbook_SheetActivate thinking it
might be a matter of sequencing, but to no avail.
**********RIBBONX CODE*******************************************
<customUI onLoad="RibbonObj" xmlns="http://schemas.microsoft.com/
office/2006/01/customui">
<commands>
<command idMso="Spelling" onAction="TestRepurpose"
getEnabled="GetEnabled" />
</commands>
</customUI>
**********THISWORKBOOK CODE*******************************************
Private Sub Workbook_Open()
TF = True
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If TF Then 'TOGGLE TF
TF = False
Else
TF = True
End If
Call RibbonReload
End Sub
**********STANDARD MODULE
CODE*******************************************
Public TF As Boolean
Dim Rib As IRibbonUI
Sub RibbonObj(ribbon As IRibbonUI)
Set Rib = ribbon
End Sub
Sub RibbonReload()
If Not Rib Is Nothing Then
Rib.Invalidate
Else
MsgBox "Rib is lost"
End If
End Sub
Sub TestRepurpose(ByRef Control As IRibbonControl, ByRef Pressed As
Variant)
MsgBox "Repurposed"
End Sub
Sub GetEnabled(ByRef Control As IRibbonControl, ByRef ReturnValue As
Variant)
ReturnValue = TF
End Sub
This is the same issue as in :
http://groups.google.com/group/micr...cc11e?hl=en&lnk=gst&q=enable#8487ca2b6b6cc11e
but with the Ribbon vs. Command Bar control.
Has anyone found a way to do this?
Best Regards,
Walt
WIN XP sp2, Excel 2007