View Single Post
 
Old 03-28-2018, 06:28 AM
Ulodesk Ulodesk is offline Windows 7 64bit Office 2013
Word 2013 Expert Cert
 
Join Date: Sep 2009
Location: Virginia
Posts: 872
Ulodesk is on a distinguished road
Default Adding terms to a search & replace macro

I found this macro on Allen Wyatt's Wordtips site. I have a multi-hundred-page document coming through soon, in which I would like to lower-case a list of words improperly capitalized. This macro handles only a single word, but takes care of instances in which the word begins a sentence; I have used the word "video". What adjustment would I need to enter more than one such term, to obviate having to make multiple single-word passes?
Is it also possible to exclude MS's built-in heading styles from the replacement, since the words would be properly capitalized there?
Thank you.

Code:
Sub ChangeCase2()
    With Selection.Find
        .ClearFormatting
        .Wrap = wdFindContinue
        .Forward = True
        .Format = True
        .MatchCase = False
        .MatchWildcards = False
        .Text = "video"
        .Execute
        While .Found
            Selection.Range.Case = wdLowerCase
            Selection.Range.Case = wdTitleSentence
            Selection.Collapse Direction:=wdCollapseEnd
            .Execute
        Wend
    End With
End Sub
Reply With Quote