#1
|
|||
|
|||
Bold Term Macro that DOES NOT bold terms with Quotation Marks
Long time lurker, first time poster. I have a macro for MS Word that searches/bolds 115 terms, however, I need the macro to avoid bolding terms that are in quotations. For example, I have the word closing in bold, but if it is displayed as "closing" then I want that term to be ignored. Is there a way to do this?
A sample of my code is below: Sub BoldPolicyWords() Dim wordsToBold(1 To 3) As String wordsToBold(1) = "word 1" wordsToBold(2) = "word 2" wordsToBold(3) = "word 3" For i = 1 To 3 With Selection.Find .Text = wordsToBold(i) .Replacement.Text = "" ' Replace with empty string (optional) .Replacement.Font.Bold = True .Forward = True .Wrap = wdFindContinue .MatchWholeWord = True End With Selection.Find.Execute Replace:=wdReplaceAll Next i End Sub |
Tags |
ignore quotations |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Searching a Word document with multiple words from a list (over 1,000 terms) and BOLD all occurrence | Nicknamednick | Word | 9 | 09-28-2022 05:41 PM |
Bold Header if it is not Bold (Check to see if it is Bold) | armendarizj | Word | 2 | 01-06-2022 05:45 PM |
bold (or unbold) section of text instead of bold toggling | Burt | Word | 6 | 04-06-2019 09:09 AM |
Customised heading styles to bold but they're not coming out bold | seanspotatobusiness | Word | 2 | 06-02-2017 02:26 PM |
Format Bold in one line makes all lines bold | Nitte | Word | 2 | 02-07-2013 12:34 AM |