Using VBA to delete text between two words
I have a text, and I want to delete the text between the words "Alfa" and "Brava".
I tried something as this, it displayes the text between, but does not delete this.
Dim rng1 As Range
Dim rng2 As Range
Dim strTheText As String
Set rng1 = ActiveDocument.Range
If rng1.Find.Execute(FindText:="Alfa") Then
Set rng2 = ActiveDocument.Range(rng1.End, ActiveDocument.Range.End)
If rng2.Find.Execute(FindText:="Brava") Then
strTheText = ActiveDocument.Range(rng1.End, rng2.Start).Text
MsgBox strTheText
End If
Any help would be appreciated.
Ward
|