![]() |
|
#5
|
||||
|
||||
|
Hi Jackson,
In that case, try: Code:
Sub DeleteH9Text()
Application.ScreenUpdating = False
Dim Rng As Range
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Style = "Heading 9"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
Do While .Find.Found
Set Rng = .Paragraphs(1).Range.Duplicate
With Rng
On Error GoTo ParaLast
While InStr(.Paragraphs.Last.Next.Style, "Heading ") = 0
.MoveEnd wdParagraph, 1
Wend
ParaLast:
.Delete
End With
.Find.Execute
Loop
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Convert numbers to a specific text string
|
francis | Excel | 1 | 10-06-2011 01:43 PM |
delete all bookmark text
|
hklein | Word VBA | 4 | 08-10-2011 04:33 AM |
Need help extracting specific text from one doument to another with macro/VBA.
|
zsmithku | Word | 1 | 04-15-2011 03:46 PM |
| Delete text | Michael007 | Office | 13 | 01-01-2011 10:38 PM |
Selecting specific text out of a series of columns
|
speedycorn1 | Word | 3 | 11-01-2010 02:58 PM |