View Single Post
 
Old 05-28-2021, 03:52 AM
Matt C's Avatar
Matt C Matt C is offline Windows 10 Office 97-2003
Advanced Beginner
 
Join Date: May 2021
Location: London, UK
Posts: 30
Matt C is on a distinguished road
Default

Thanks, Andrew, that worked a treat.

I'm finding the second part a bit tricky. I've got as far as the code below which only removes the first instance of a "(" from the relevant paragraph style, then stops. I couldn't get a standard find/replace to work - it just left all the brackets in place.

Quote:
Sub RemoveBrackets()

Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Custom Style")
With Selection.Find
.Text = "("
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
End With
Selection.Find.Execute
Selection.Delete Unit:=wdCharacter, Count:=1
End Sub
Can I tweak the above to loop through the document finding and deleting both "(" and ")" at the same time (in only "Custom Style" paragraphs)?
Reply With Quote