D
Don
Hi.........
I would like to be able to write a Macro that selects the
first the current parapraph as well as the one above. If
either of those two paragraphs are a secion break, I would
like to repalce it with nothing.
This code seems to be close, but I think the problem lies
with wdRepalceAll (although I could be wrong). I just
want the code to find/select/replace the two selected
paragraphs and not the entire document. As it stand now,
it does the entire doc. Can anyone see where I am going
wrong? I might want to consider remove the prompt for
wdask as well, so the user is never prompted to check the
rest of the document.
Thanks in Advance,
Don
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 9/11/2003 by Gibbons, Del Deo
'
Selection.EndOf Unit:=wdParagraph, Extend:=wdMove
Selection.MoveUp Unit:=wdParagraph, Count:=2,
Extend:=wdExtend
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^b"
.Replacement.Text = ""
.Forward = False
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
End Sub
I would like to be able to write a Macro that selects the
first the current parapraph as well as the one above. If
either of those two paragraphs are a secion break, I would
like to repalce it with nothing.
This code seems to be close, but I think the problem lies
with wdRepalceAll (although I could be wrong). I just
want the code to find/select/replace the two selected
paragraphs and not the entire document. As it stand now,
it does the entire doc. Can anyone see where I am going
wrong? I might want to consider remove the prompt for
wdask as well, so the user is never prompted to check the
rest of the document.
Thanks in Advance,
Don
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 9/11/2003 by Gibbons, Del Deo
'
Selection.EndOf Unit:=wdParagraph, Extend:=wdMove
Selection.MoveUp Unit:=wdParagraph, Count:=2,
Extend:=wdExtend
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^b"
.Replacement.Text = ""
.Forward = False
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
End Sub