Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-28-2018, 06:28 AM
Ulodesk Ulodesk is offline Adding terms to a search & replace macro Windows 7 64bit Adding terms to a search & replace macro Office 2013
Word 2013 Expert Cert
Adding terms to a search & replace macro
 
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
 

Tags
search and replace



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding terms to a search & replace macro VBA code to compile one document based on multiple search terms Hoxton118 Word VBA 4 04-04-2021 06:02 AM
Adding terms to a search & replace macro Best Practice for Indexing Multiple Word Terms and Sub-Terms jhy001 Word 4 11-06-2017 02:08 PM
Macro on Search and Replace davidhuy Word VBA 1 12-19-2014 04:47 AM
Onenote 2013 search is not identifying search terms correctly Delta223 OneNote 0 08-12-2014 06:40 AM
How do I search for terms in initial upper-case? bertietheblue Word 5 05-02-2012 05:24 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:00 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft