![]() |
|
#1
|
|||
|
|||
|
Hi
I have no idea where to start with this one (can clear all text within parenthesis no problem but i specifically need to delete as follows)I am looking to delete all text with the following criteria when in parenthesis some start with (formerly ) and some are (formerly John Wilson) with John Wilson being totally random could be any combination up to 25 characters End result - all deleted including parenthesis Any help greatly appreciated Thanks Steve The following works for (formerly ) as above but needing to catch (formerly John Wilson) << John Wilson could be anything random Sub replacetext() Dim test test = "(formerly )" Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = test .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub Last edited by NoLockdownsLOL; 07-14-2021 at 05:04 PM. |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Enclose All Instances of a Specific Custom Style in Brackets
|
Matt C | Word VBA | 7 | 05-30-2021 04:52 AM |
find/replace all text not a specific colour?
|
LQuinn | Word VBA | 3 | 04-06-2021 04:51 PM |
find and delet all text within brackets and the brackets themselves
|
wrdy | Word | 2 | 08-03-2017 06:55 PM |
Find and Replace - How to insert brackets around all numbers in a doc
|
Natedogg | Word | 2 | 05-21-2015 07:16 AM |
Find/Replace Brackets Problem
|
fatso | Word | 2 | 08-04-2011 11:34 AM |