R
ravi venkata
Call CheckPara("some text here")
Sub CheckPara(str As String)
Dim p As Paragraph
Dim flag As Boolean
For Each p In ActiveDocument.Paragraphs
flag = False
For i = 1 To p.Range.Words.Count
If Trim(p.Range.Words(i).Text) = str Then
flag = True
Exit For
End If
Next i
If flag = False Then
p.Range.Delete
End If
Next p
End Sub
Sub CheckPara(str As String)
Dim p As Paragraph
Dim flag As Boolean
For Each p In ActiveDocument.Paragraphs
flag = False
For i = 1 To p.Range.Words.Count
If Trim(p.Range.Words(i).Text) = str Then
flag = True
Exit For
End If
Next i
If flag = False Then
p.Range.Delete
End If
Next p
End Sub
have a certain word in them. How do I do that?-----Original Message-----
i want to delete all paragraphs in a document that don't