View Single Post
 
Old 01-12-2022, 09:03 AM
burniksapwet burniksapwet is offline Windows 10 Office 2007
Novice
 
Join Date: Jan 2022
Posts: 6
burniksapwet is on a distinguished road
Default

Quote:
Originally Posted by gmayor View Post
You cannot select non-contiguous items with VBA. You can select them sequentially, but then there would have to be some point in doing so. What do you want to do with them once found?
E.g. The following will highlight the texts so formatted:
Code:
Sub Macro1()
    With Selection.Find
        .ClearFormatting
        With .Font
            .Name = "Times New Roman"
            .Size = 12
            .Bold = True
        End With
        .Replacement.ClearFormatting

        Options.DefaultHighlightColorIndex = wdYellow
        .Replacement.Highlight = True

        .Text = ""
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        .Execute Replace:=wdReplaceAll
    End With
End Sub
This is absolutely amazing. And yes I wanted it highlighted, I forgot to mention that. Thank you so much for looking into this and creating it for me. Much appreciated.
Reply With Quote