Delete a line which has a unique Style with a macro

O

Octavee Uhl

Hello,

I am trying to find a way to delete many lines in a document, which all have
a unique paragraph style. How can I do that?

Thanks
Octavee
 
D

Doug Robbins - Word MVP

Use the following:

Selection.HomeKey wdStory
Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles("Heading
1,Section,Main,h1,Heading1")
With Selection.Find
Do While .Execute(FindText:="", MatchWildcards:=False, Wrap:=wdFindStop,
Forward:=True) = True
Selection.Range.Bookmarks("\line").Range.Delete
Loop
End With

Replace Heading 1,Section,Main,h1,Heading1 with the name of the style that
you want to use.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top