- Local time
- Today, 02:01
- Joined
- Feb 19, 2002
- Messages
- 46,159
I am writing documents that require the suit symbols for clubs, diamonds, hearts, and spades and I would like the diamonds and hearts to be red.
My old macros no longer work so I created new ones. I couldn't get the macro recorder to control the color so I did it the hard way.
The problem with this method is that not all text is black. The user may be using a themed color choice so a better solution would be to copy the current color and save it to a variable. Change the color to red, insert the symbol. Then change the color back to what it was originally.
I develop with Access so the Word object model mystifies me and so I rely on the macro recorder to record macros for me. But the macro recorder will not create code to manage the color changes.
Does anyone know the VBA to do this so I can update the macro?
Thanks
My old macros no longer work so I created new ones. I couldn't get the macro recorder to control the color so I did it the hard way.
Code:
Sub Heart()
' Heart Macro'
'
Selection.Font.Color = vbRed
Selection.InsertSymbol Font:="Symbol", CharacterNumber:=-3927, Unicode:=True
Selection.Font.Color = vbBlack
End Sub
The problem with this method is that not all text is black. The user may be using a themed color choice so a better solution would be to copy the current color and save it to a variable. Change the color to red, insert the symbol. Then change the color back to what it was originally.
I develop with Access so the Word object model mystifies me and so I rely on the macro recorder to record macros for me. But the macro recorder will not create code to manage the color changes.
Does anyone know the VBA to do this so I can update the macro?
Thanks