Dear Newzad,
Assume your text looks like this:
#1 The cat sat on the mat. The cat sat on the mat. The cat sat on the mat.
The cat sat on the mat. The cat sat on the mat. The cat sat on the mat. The
cat sat on the mat. The cat sat on the mat.¶
¶
#2 Now is the time for all good men to attend the next party. Now is the
time for all good men to attend the next party. Now is the time for all good
men to attend the next party. Now is the time for all good men to attend the
next party. Now is the time for all good men to attend the next party. Now
is the time for all good men to attend the next party. Now is the time for
all good men to attend the next party. Now is the time for all good men to
attend the next party. Now is the time for all good men to attend the next
party. Now is the time for all good men to attend the next party. Now is the
time for all good men to attend the next party. Now is the time for all good
men to attend the next party. Now is the time for all good men to attend the
next party. ¶
¶
#3 The cat sat on the mat. The cat sat on the mat. The cat sat on the mat.
The cat sat on the mat. The cat sat on the mat. The cat sat on the mat. The
cat sat on the mat. The cat sat on the mat
1 Start macro recording, name, assign shortcut keys.
2 Search for #2 and press Esc
3 Right arrow once.
4 Search for ¶¶ [use ^p^p in search window] and press Esc
5. Right arrow once (places cursor to left of "#3".)
6, Shift-ctrl-up twice.
7 Delete
8. Stop macro recording
This should allow you to delete #2 para no matter how long it is, provided
it always ends with two carriage returns. If more than two, alter step 2
appropriately.
Should get a macro that looks like this:
Sub Junk()
'
' Junk Macro
' Macro recorded 6/1/2005 by RO
'
Selection.Find.ClearFormatting
With Selection.Find
.Text = "#2"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^p^p"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.MoveUp Unit:=wdParagraph, Count:=2, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
End Sub
Hope this helps.
Richard