C
cyberdude
Hi,
A visitor here gave me the following code to highlight a block of
words ending with "test" and delete it.
Sub Testb()
Dim x As Long
Dim rDcm As Range
Set rDcm = Selection.Range
x = rDcm.start
rDcm.End = ActiveDocument.Range.End
With rDcm.Find
.Text = "test"
If .Execute Then
rDcm.start = x
rDcm.HighlightColorIndex = wdYellow
rDcm.Delete
End If
End With
End Sub
If I remove the line "rDcm.Delete", then the code highlights the block
of text without deleting it. I would like to further change it so
that the cursor stops behind the word "test". Could someone tell me
how to do that? Thanks.
Mike
A visitor here gave me the following code to highlight a block of
words ending with "test" and delete it.
Sub Testb()
Dim x As Long
Dim rDcm As Range
Set rDcm = Selection.Range
x = rDcm.start
rDcm.End = ActiveDocument.Range.End
With rDcm.Find
.Text = "test"
If .Execute Then
rDcm.start = x
rDcm.HighlightColorIndex = wdYellow
rDcm.Delete
End If
End With
End Sub
If I remove the line "rDcm.Delete", then the code highlights the block
of text without deleting it. I would like to further change it so
that the cursor stops behind the word "test". Could someone tell me
how to do that? Thanks.
Mike