dj44
05-25-2017, 09:24 AM
folks,,
good thursday
I have got stuck on how to replace the second hyphen in some paragraphs
Sub Second_Hyphen()
Dim lngIndex As Long: lngIndex = 1
For Each oPara In ActiveDocument.Paragraphs
If InStr(1, oPara.Range.Text, "Test1") > 0 Then
Set oRng = oPara.Range
With oRng.Find
.Text = "-"
.MatchWholeWord = True
.Replacement.Text = "[Delete]"
.Execute Replace:=wdReplaceOne '<< only the second hyphen
End With
End If
Next oPara
End Sub
thank you for any advice on this loop that i couldnt implement
good thursday
I have got stuck on how to replace the second hyphen in some paragraphs
Sub Second_Hyphen()
Dim lngIndex As Long: lngIndex = 1
For Each oPara In ActiveDocument.Paragraphs
If InStr(1, oPara.Range.Text, "Test1") > 0 Then
Set oRng = oPara.Range
With oRng.Find
.Text = "-"
.MatchWholeWord = True
.Replacement.Text = "[Delete]"
.Execute Replace:=wdReplaceOne '<< only the second hyphen
End With
End If
Next oPara
End Sub
thank you for any advice on this loop that i couldnt implement