View Single Post
 
Old 03-27-2024, 11:55 AM
IndianaITGuy IndianaITGuy is offline Windows 11 Office 2019
Novice
 
Join Date: Mar 2024
Location: Martinsville, IN
Posts: 25
IndianaITGuy is on a distinguished road
Default

Quote:
Originally Posted by vivka View Post
Hi! It's not difficult:
Code:
Sub Test()
Dim oRng As range
    Set oRng = selection.range
    With oRng.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .text = "Y[! ]@" & Chr(13)
        .Format = False
        .Forward = True
        .MatchWildcards = True
        .Wrap = wdFindStop
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        If .Execute Then oRng.Select
    End With
 Set oRng = Nothing
End Sub
Modify the code to meet your needs.

You have me at a disadvantage with the value of .Text. I've looked but nothing good really jumped out at me with regard to special characters. Microsoft Help was not much. What is a good reference for all such special codes when searching for text? I've seen combinations of [], (), /, \, *, whatever. I just want to be able to recognize when there is one, specific word/string alone on a line that starts with a letter of my choosing. In my case it will be an X or Y. No whitespaces in this string.
Reply With Quote