View Single Post
 
Old 03-28-2014, 03:46 PM
newbieX newbieX is offline Windows 7 64bit Office 2007
Novice
 
Join Date: Mar 2014
Posts: 6
newbieX is on a distinguished road
Default

Quote:
Originally Posted by fumei View Post
1. you should use Styles, rather than manual formatting
2. are the sentences contiguous?
I think I figured it out. I just make the text a different color and change it that way. (I'm working from a template.)

It does what I want, so all is good. Suggestions on how to condense code would be nice. I'm always game to learn.

Code:
Sub ChangeColorWithReplace()

    Selection.WholeStory
    Selection.Font.Name = "Arial"
    Selection.Font.Size = 10
    Selection.Collapse
    Selection.Find.ClearFormatting
    Selection.Find.Font.Color = wdColorYellow
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Font.Color = wdColorAuto
    Selection.Find.Replacement.Font.Size = 8
    
    With Selection.Find
        .Text = ""
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchKashida = False
        .MatchDiacritics = False
        .MatchAlefHamza = False
        .MatchControl = False
        .MatchByte = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    
    Selection.Find.Execute Replace:=wdReplaceAll
    
    Selection.WholeStory
    Selection.Font.Color = wdColorAutomatic
    Selection.Collapse
End Sub
Reply With Quote