View Single Post
 
Old 01-07-2018, 07:20 PM
Helend269 Helend269 is offline Windows 7 32bit Office 2003
Novice
 
Join Date: Aug 2017
Posts: 15
Helend269 is on a distinguished road
Default Delete certain characters from a line

I have a situation where I need to go through a document, find a certain word and when that word has been found go down one line and if that line contains either opening or closing parenthesis then delete those two characters.

So:

Word
(sample text)

becomes

Word
sample text

All I have so far is:

Application.ScreenUpdating = False
Selection.HomeKey Unit:=wdStory
With Selection.Find
.ClearFormatting
.Wrap = wdFindStop
.Text = "WORD"
Do While .Execute
Selection.MoveDown Unit:=wdLine, Count:=1
'delete any instances of ( and ) from that line
Loop
End With
Application.ScreenUpdating = True

How can I do this, please? Many thanks.
Reply With Quote