Change font Colour/Color

J

JayM

I have a template document on which I want to be able to change lightblue to
black after drafting the document.

I have the following code in my macro at the moment and it works ok I just
wondered if there was a more efficient way of writing it that I haven't
thought of or if I should do some error checking on it as well.

Still finding my way around vba at the moment and am improving with the help
of this site.

Public Sub SetTextToBlack()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Font.Color = wdColorLightBlue
.Replacement.Font.Color = wdColorBlack
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.Find.Execute Replace:=wdReplaceAll
Selection.MoveRight

End Sub


Many thanks

JayM
 
M

macropod

Hi Jay,

The efficient way is use an appropriate set of styles, and to format their font attributes appropriately. That way, changing the
font colour is as easy as changing the style attributes - do it there and it immediately updates every paragraph in the document
based on that style.

Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top