Macro to change font color

I'd like to assign keyboard shortcuts to 3 different macros to change the font color to:


1. Custom Purple:

- Red 255

- Green 0

- Blue 255


2. Light Blue

3. Red


I've read another question on a similar topic that explained how to do it with changing the character style but I don't want it to change the font or other formatting options, just the color.  Is there a way to do this with macros?  I ran across this macro for Excell:


Sub changeTextColor()

    GreenColor = RGB(0, 255, 0)
    RedColor = RGB(255, 0, 0)
    BlackColor = RGB(0, 0, 0)
       
End Sub

Is there a way to edit this to what I want?  I'm afraid I'm not familiar with editing macros, just recording them.

Answer
Answer

Word calls your "custom purple" pink.

  • Press Alt+F11 to activate the Visual Basic Editor.
  • Click on Normal in the explorer-like pane on the left hand side.
  • Select Insert > Module.
  • Copy the following code into the new module:

Sub FontPink()
    Selection.Font.Color = wdColorPink
End Sub

Sub FontLightBlue()
    Selection.Font.Color = wdColorLightBlue
End Sub

Sub FontRed()
    Selection.Font.Color = wdColorRed
End Sub

  • Switch back to Word.
  • Assign keyboard shortcuts to the macros (File > Options > Customize Ribbon > Customize...)

When you quit Word, it may ask you whether you want to save changes to Normal.dotm. If so, click Yes.

---
Best wishes, HansV
https://www.eileenslounge.com

35 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated March 30, 2024 Views 37,045 Applies to: