Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-14-2021, 02:55 PM
NoLockdownsLOL NoLockdownsLOL is offline replace specific text within brackets Windows 10 replace specific text within brackets Office 2019
Novice
replace specific text within brackets
 
Join Date: Jul 2021
Location: Brisbane, Australia
Posts: 4
NoLockdownsLOL is on a distinguished road
Default replace specific text within brackets

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.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
replace specific text within brackets Enclose All Instances of a Specific Custom Style in Brackets Matt C Word VBA 7 05-30-2021 04:52 AM
replace specific text within brackets find/replace all text not a specific colour? LQuinn Word VBA 3 04-06-2021 04:51 PM
replace specific text within brackets find and delet all text within brackets and the brackets themselves wrdy Word 2 08-03-2017 06:55 PM
replace specific text within brackets Find and Replace - How to insert brackets around all numbers in a doc Natedogg Word 2 05-21-2015 07:16 AM
replace specific text within brackets Find/Replace Brackets Problem fatso Word 2 08-04-2011 11:34 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:04 PM.


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