Hi
I've just made it
in the addin's module:
Public myRibbon As IRibbonUI
Sub Ribbon_customization_OnLoad(ByVal ribbon As Office.IRibbonUI)
Set myRibbon = ribbon
End Sub
Sub set_freezerow(control As IRibbonControl, Text As String)
If IsNumeric(Text) Then
with activewindow
.splitrow = CInt(Text)
.FreezePanes = True
end with
End If
End Sub
sub get_freezerow(control As IRibbonControl, ByRef Text)
If Not ActiveWindow Is Nothing Then
Text = ActiveWindow.SplitRow
Else
Text = -1
End If
End Sub
in the addin's workbook object:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
myRibbon.InvalidateControl "ebox_set_row"
End Sub
in the customUI.xml:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="Ribbon_customization_onLoad">
<tabs>
...
<editBox id="ebox_set_row"
label="Freeze rows"
maxLength="2"
onChange="set_freezerow"
getText="get_freezerow"
sizeString="2"/>
...
</tabs>
I have one final problem. That is the myribbon variable could be easily cleared (by an 'end' statement, error in a macro, stc.), is there a workaround so that the ribbon (and the controls) could be accessed without this intermediate variable?
yours
istvan
Bookmarks