Thread: [Solved] Word macro wildcard issue
View Single Post
 
Old 01-11-2024, 08:35 AM
syl3786 syl3786 is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: Jan 2023
Posts: 97
syl3786 is on a distinguished road
Default

Quote:
Originally Posted by vivka View Post
Unfortunately, I rarely work in Excel and I'm not a programmer, so I can suggest a Word code to illustrate using a range:
Code:
Sub Replace_Digits_With_Wds()

Dim oRng As range

Application.ScreenUpdating = False
Set oRng = ActiveDocument.range
    With oRng.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Forward = True
        .Wrap = wdFindStop
        .Format = True
        .MatchWildcards = True
        .text = Chr(9) & "1([!0-9])"
        While .Execute
            oRng.End = oRng.End - 1
            oRng = Chr(9) & "-"
            oRng.Font.ColorIndex = wdBrightGreen
            oRng.Collapse wdCollapseEnd
        Wend
Application.ScreenUpdating = True
Set oRng = Nothing
End With
Thank you for sharing your suggestions. While I understand that you may not have extensive experience working with Excel or programming, I appreciate your input and willingness to contribute. I will take your suggestion into consideration and explore the possibility of incorporating a Word code that utilizes a range.
Reply With Quote