Q1 - are Top/Bottom aligned just an example?
Q2 - I don't think there's any events that are triggered on a cell format change, only of a Selection change, Value change, or a Calculate
XML using getImage with a callback to show an MSO image, and the callbacks
there's two WS events on SHeet1 also
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="OnRibbonLoad" >
<ribbon>
<tabs>
<tab id="CustomTab" label="My Tab">
<group id="CustomGroup4" label="From Worksheet" insertBeforeMso="GroupClipboard">
<button id="buttonOne" label="Button1" size="large" onAction = "ClickButtonCard" getImage="Card"/>
<button id="buttonTwo" label="Button2" size="large" onAction = "ClickButtonCard" getImage="Card"/>
<button id="buttonThree" label="Button3" size="large" onAction = "ClickButtonCard" getImage="Card"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
Option Explicit
Public oRibbon As IRibbonUI
'Callback for customUI.onLoad
Sub OnRibbonLoad(ribbon As IRibbonUI)
Set oRibbon = ribbon
End Sub
'Callback for buttonOne onAction
Sub ClickButtonCard(control As IRibbonControl)
MsgBox control.id
End Sub
'Callback for buttonOne getImage
Sub Card(control As IRibbonControl, ByRef returnedVal)
With Worksheets("Sheet1")
Select Case control.id
Case "buttonOne"
Select Case .Cells(2, 1)
Case 1
returnedVal = "Spade"
Case 2
returnedVal = "Club"
Case 3
returnedVal = "Heart"
Case Else
returnedVal = "Diamond"
End Select
Case "buttonTwo"
Select Case .Cells(2, 2)
Case 1
returnedVal = "Spade"
Case 2
returnedVal = "Club"
Case 3
returnedVal = "Heart"
Case Else
returnedVal = "Diamond"
End Select
Case "buttonThree"
Select Case .Cells(2, 3)
Case 1
returnedVal = "Spade"
Case 2
returnedVal = "Club"
Case 3
returnedVal = "Heart"
Case Else
returnedVal = "Diamond"
End Select
End Select
End With
oRibbon.InvalidateControl control.id
End Sub