In the example i changed the color of the first word (out of two) in cell B7 from black to red.
The macro recorder suggests:
Code: Select all
sub Main
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$B$7"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Color"
args2(0).Value = 16711680
dispatcher.executeDispatch(document, ".uno:Color", "", 0, args2())
end sub
Within a Function i have a loop to construct the resulting String
Function = Function & characterN
I'd like to control the color of each characterN
Is this possible within a macro? Thx in advance