In Calc, I write a macro to set the current cell’s format to text,
so any number inside will not be interpreted as date or somewhat.
Then I add a button which binds to this macro to toolbar,
and I use it like format as currency or other built-in formatting button.
But these built-in buttons’ color will change if the current cell is that kind of format.
How can I change my macro button’s color like that?
Following is my macro code:
REM bound as vnd.sun.star.script:Standard.Module1.format_as_text?language=Basic&location=application
sub format_as_text
dim oDoc
dim oFormats
dim oRange
oDoc = ThisComponent
oRange = oDoc.CurrentSelection
oFormats = oDoc.NumberFormats
Dim aLocale As New com.sun.star.lang.Locale
oRange.NumberFormat = oFormats.getStandardFormat(_
com.sun.star.util.NumberFormat.TEXT, aLocale)
end sub