View Single Post
 
Old 03-10-2024, 11:22 AM
vivka vivka is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Jul 2023
Posts: 293
vivka is on a distinguished road
Default

Try the following:
Code:
Sub Del_Test()
Dim oRng As range
    Set oRng = selection.Paragraphs(2).range
    If InStr(oRng, "Example") Then
        oRng.Collapse
        oRng.MoveEndUntil cset:="Example" 
    Else
        oRng.Collapse
        oRng.MoveEnd unit:=wdCharacter, count:=8
    End If
    oRng.Delete
Set oRng = Nothing
End Sub
Reply With Quote