![]() |
|
#1
|
|||
|
|||
![]() Thank you, Macropod! |
#2
|
|||
|
|||
![]()
I used the macro below you provided in this chat and it works, thanks! However, would it be possible to limit it to the text I selected in the active document only? The seperate document has 2000 words, so if the active document has too mucht text it will ages... Even though I might only want to scan like 100 words to be highlighted. If anyone can help, much appreciated!
Sub B2_Highlighter_Selection_andAllWordForms() Application.ScreenUpdating = False Options.DefaultHighlightColorIndex = wdBrightGreen Dim FRDoc As Document, FRList, i As Long Set FRDoc = Documents.Open("C:\path.docx", ReadOnly:=True, Addtorecentfiles:=False, Visible:=False) FRList = FRDoc.Range.Text: FRDoc.Close False: Set FRDoc = Nothing With Selection.Range.Find .ClearFormatting .Replacement.ClearFormatting .MatchWholeWord = True .MatchCase = False .Replacement.Text = "^&" .Replacement.Highlight = True 'Process each word from the List For i = 0 To UBound(Split(FRList, vbCr)) - 1 .Text = Split(FRList, vbCr)(i) .Execute Replace:=wdReplaceAll Next End With Application.ScreenUpdating = True End Sub |
![]() |
Tags |
find, highlight, macro |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
karkey | Word VBA | 3 | 01-05-2021 02:13 PM |
![]() |
abhimanyu | Word VBA | 5 | 03-20-2020 01:33 PM |
How to find (highlight) two and more words in a list of 75k single words in Word 2010 | Usora | Word | 8 | 05-29-2018 03:34 AM |
![]() |
bakerkr | Word VBA | 4 | 10-19-2017 02:23 PM |
![]() |
RBLampert | Word VBA | 13 | 10-23-2012 04:45 PM |