S
Steve D
Hello...I want to be able to apply the List Bullet style on all paragraphs
that begin with "*<sp><sp>" and then delete these first three characters
(I'm cleaning up docs from others that don't know about bullets). What's the
best way to do this?
I've automated Find/Replace and find I have to do this in two F/R steps.
First, Find "*<sp><sp>" and replace with "" (empty string") and set the
style of Replace to "List Bullet". Second, leave Find set to "*<sp><sp>",
leave the Replace empty string and clear the Replace style. This then
removes the "*<sp><sp>" strings in each paragraph.
I recorded a macro to do this (below), but the
Selection.Find.Replacement.ParagraphFormat.Borders.Shadow = False command
now creates a border around the changed paragraphs. If I remove this line,
no Find/Replace gets triggered.
Question: Is there an easier way to do this? How about enumerating all the
paragraphs in the doc and looking to see if their first three characters are
"*<sp><sp>". If yes, then set the style of the paragraph to "List Bullet".
What's the best way to parse the first three characters of each paragraph in
the Paragraphs collection?
Thanks for any and all help.
Steve
Sub Macro1()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles("List Bullet")
Selection.Find.Replacement.ParagraphFormat.Borders.Shadow = False <--
Offending
command??
With Selection.Find
.Text = "- "
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "- "
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
that begin with "*<sp><sp>" and then delete these first three characters
(I'm cleaning up docs from others that don't know about bullets). What's the
best way to do this?
I've automated Find/Replace and find I have to do this in two F/R steps.
First, Find "*<sp><sp>" and replace with "" (empty string") and set the
style of Replace to "List Bullet". Second, leave Find set to "*<sp><sp>",
leave the Replace empty string and clear the Replace style. This then
removes the "*<sp><sp>" strings in each paragraph.
I recorded a macro to do this (below), but the
Selection.Find.Replacement.ParagraphFormat.Borders.Shadow = False command
now creates a border around the changed paragraphs. If I remove this line,
no Find/Replace gets triggered.
Question: Is there an easier way to do this? How about enumerating all the
paragraphs in the doc and looking to see if their first three characters are
"*<sp><sp>". If yes, then set the style of the paragraph to "List Bullet".
What's the best way to parse the first three characters of each paragraph in
the Paragraphs collection?
Thanks for any and all help.
Steve
Sub Macro1()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles("List Bullet")
Selection.Find.Replacement.ParagraphFormat.Borders.Shadow = False <--
Offending
command??
With Selection.Find
.Text = "- "
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "- "
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub