Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-22-2023, 09:19 AM
AlanCantor AlanCantor is offline vba macro to remove wildcard patterns and replace with static Windows 10 vba macro to remove wildcard patterns and replace with static Office 2019
Competent Performer
 
Join Date: Nov 2020
Posts: 154
AlanCantor is on a distinguished road
Default

This will get you close:




Code:
Sub Remove012PhoneNumbers()
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "<012[0-9]{7}>"
        .Replacement.Text = "REMOVED"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
vba macro to remove wildcard patterns and replace with static How to code a Find&Replace macro to remove a tab and bold the entire para Frogoogue Word VBA 4 05-30-2022 09:15 AM
Wildcard find/replace wildcard question hephalumph Word 1 03-12-2022 12:54 AM
vba macro to remove wildcard patterns and replace with static Static Folder Locations to Automate a Find and Replace using Word VBA rmoyar Word VBA 9 01-29-2020 02:35 PM
Macro for Find/replace to remove space before Hard Return AlfredStreich Word VBA 4 01-23-2020 03:59 PM
Need Help With Find and Replace Wildcard rsrasc Word VBA 9 10-13-2015 02:37 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:49 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft