[Find paras that start with a dash, remove dash, apply list style]
Hi Jason,
You can do it with three simple replacements (...two if you use wildcards):
1.
Find what: ^p-^w
Replace with: ^p#list#
#list# is just some arbitrary tag to mark up the list paragraphs.
^p-^w matches a para mark, a hyphen, and any whitespace like spaces or tabs
that follow it.
2.
Find what: #list#
Replace with: ((list style))
3.
Find what: #list#
Replace with: ((nothing... leave empty))
With wildcards, you can combine 2. and 3.:
Use Wildcards,
Find what: #list#(?)
Replace with: \1 ((plus list style))
\1 inserts the stuff that is in (brackets). In this case, that's the ?
wildcard, matching any character that followed the #list# tag.
This applies the list style ("List Alpha" in your case), and at the same
time removes the #list# tag.
Regards,
Klaus
Jason L - 16 Nov 2004 20:54 GMT
Klaus,
Thanks so much. Here is the code I have thus far. Right now it's actually
replacing the areas with the following {{ListAlpha}}, instead of the actual
style. I'm pretty sure I did something wrong. Would you mind looking the
small bit of code and helping out. I'd appreciate it. Thanks.
With Selection.Find
.Text = "^p-^w"
.Replacement.Text = "^p#list#"
'.Replacement.Text = "^+"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = "#list#"
.Replacement.Text = "{{ListAlpha}}"
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
''This code then clears any formatting and begins the search.
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
'
Selection.HomeKey Unit:=wdStory
With Selection.Find
.Text = "#list#"
.Replacement.Text = "{{ }}"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
> [Find paras that start with a dash, remove dash, apply list style]
>
[quoted text clipped - 30 lines]
> Regards,
> Klaus
Klaus Linke - 17 Nov 2004 12:32 GMT
Hi Jason,
> 2.
> Find what: #list#
> Replace with: ((list style))
That meant:
Type "#list#" in "Find what:"
Leave "Replace with empty (or use "^&" = Find what text), go to "More >
Format > Styles" and select your "List Alpha" style.
Word then goes to each occurrence of "#list#", and applies your style.
Then, in the 3rd replacement, you delete the tag "#list#" by replacing it
with nothing.
Regards,
Klaus