JohnV Administrator

Joined: 07 Mar 2003 Posts: 8979 Location: Lexinton, Kentucky, USA
|
Posted: Thu Jun 04, 2009 12:07 pm Post subject: |
|
|
Here are a couple of macro you can play with. Apply a font color to some text and run the 1st one to determine the number of that color (black is -1). Use the numbers in the second macro. | Code: | Sub GetColorNumber
odoc = ThisComponent
oVC = oDoc.CurrentController.getViewCursor
MsgBox oVC.CharColor
End Sub
Sub SetFontColor
odoc = ThisComponent
oVC = oDoc.CurrentController.getViewCursor
a$ = "Select color by its number." & Chr(13)
b$ = "1. Red 2. Blue 3. Black"
sAns = InputBox(a$ & b$,"Color Picker","3")
If sAns = "" then End 'Cancel clicked or no answer.
num = cInt(sAns)
Select Case num
Case 1 : num = 16724838
Case 2 : num = 39423
Case 3 : oVC.setPropertyToDefault("CharColor") : End
Case Else : MsgBox num & " is not in the list." : End
End Select
oVC.CharColor = num
REM If you only want to to color selected text then remove
REM the comments from the next 2 lines.
'oVC.collapseToEnd
'oVC.setPropertyToDefault("CharColor")
End sub |
|
|