For example, I might want to delete all 'Normal" styled paragraphs and leave only the 'Heading " styled paragraphs behind.
This macro does the trick, regardless of the styles in use!
Sub DeleteAllParagraphsThisStyle()
''' Place the text cursor in a paragraph, run the macro.
''' All paragraphs in that (selected) style will be removed from the document.
Dim strStyleName As String
strStyleName = Selection.Paragraphs(1).Range.Style
Dim lng As Long
For lng = ActiveDocument.Paragraphs.Count To 1 Step -1
If ActiveDocument.Paragraphs(lng).Style = strStyleName Then
ActiveDocument.Paragraphs(lng).Range.Delete
Else
End If
Next lng
End Sub
No comments:
Post a Comment