OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Keyboard shortcut for font color?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer
View previous topic :: View next topic  
Author Message
Invain
General User
General User


Joined: 06 Apr 2009
Posts: 12

PostPosted: Thu Jun 04, 2009 9:38 am    Post subject: Keyboard shortcut for font color? Reply with quote

Hi,
how can I create a shortcut to change the font color to a specific color? Is it possible?
Back to top
View user's profile Send private message
JohnV
Administrator
Administrator


Joined: 07 Mar 2003
Posts: 9183
Location: Lexinton, Kentucky, USA

PostPosted: Thu Jun 04, 2009 12:07 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group