Hallo,
Was ich weiß ist die Möglichkeit, dass man mit GetVisible True/False von Buttons ein scheinbares Austauschen hin getrickst bekommt.
ins RibbonUI:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="onLoad_Uwe">
<ribbon>
<tabs>
<tab id="Tab1" label="User">
<group id="Gruppe1" label="Füllfarben">
<button id="Button1" label="Farbe Gelb" getVisible="getVisible_Button1" imageMso="ShapeFillColorPickerClassic" size="large" onAction="onAction_Button1" />
<button id="Button2" label="Farbe Rot" getVisible="getVisible_Button2" imageMso="FontAlternateFillBackColorPicker" size="large" onAction="onAction_Button2" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
in ein allgemeines Modul:
Option Private Module
Option Explicit
Public objRibbon As IRibbonUI
Public Sub onLoad_Uwe(ribbon As IRibbonUI)
Set objRibbon = ribbon
End Sub
Public Sub onAction_Button1(control As IRibbonControl)
MsgBox "Button " & control.ID & " gedrückt", 64, "Hinweis"
End Sub
Public Sub onAction_Button2(control As IRibbonControl)
MsgBox "Button " & control.ID & " gedrückt", 64, "Hinweis"
End Sub
Public Sub getVisible_Button1(control As IRibbonControl, ByRef returnValue)
If Tabelle1.Cells(1, 1) = "Gelb" Then
returnValue = True
Else
returnValue = False
End If
End Sub
Public Sub getVisible_Button2(control As IRibbonControl, ByRef returnValue)
If Tabelle1.Cells(1, 1) = "Rot" Then
returnValue = True
Else
returnValue = False
End If
End Sub
ins Modul des Tabellenblattes:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then objRibbon.Invalidate
End Sub
Gruß Uwe
|