S
Steve D
Hi all...what approach would you suggest for adding a bullet character and
two spaces ("? ") in front of each selected paragraph in a document? (I
don't want to use a list style or the "Bullets" toolbar button because I'm
pasting the paragraphs into an Excel worksheet cell)
So far, I've successfully added bullet in front of all paragraphs with the
following code using Find/Replace (mostly from Macro recorder). The code
individually inserts the bullet at the beginning of the doc (because F/R
didn't find that one) and then individually removes the bullet and spaces
from the end of the doc (because F/R added a superfluous bullet at the end).
I want to now add bullets only to selected paragraphs. I need to cover the
corner-case where the first paragraph may be selected and a Find/Replace
won't work on it.
Any help greatly appreciated!
Steve
Sub AddBullets()
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p"
.Replacement.Text = "^p" & ChrW(9642) & " "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
Selection.TypeText Text:=ChrW(9642) & " "
Selection.EndKey Unit:=wdStory
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
End Sub
two spaces ("? ") in front of each selected paragraph in a document? (I
don't want to use a list style or the "Bullets" toolbar button because I'm
pasting the paragraphs into an Excel worksheet cell)
So far, I've successfully added bullet in front of all paragraphs with the
following code using Find/Replace (mostly from Macro recorder). The code
individually inserts the bullet at the beginning of the doc (because F/R
didn't find that one) and then individually removes the bullet and spaces
from the end of the doc (because F/R added a superfluous bullet at the end).
I want to now add bullets only to selected paragraphs. I need to cover the
corner-case where the first paragraph may be selected and a Find/Replace
won't work on it.
Any help greatly appreciated!
Steve
Sub AddBullets()
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p"
.Replacement.Text = "^p" & ChrW(9642) & " "
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
Selection.TypeText Text:=ChrW(9642) & " "
Selection.EndKey Unit:=wdStory
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
Selection.TypeBackspace
End Sub