Adding a bullet in front of each paragraph

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
 
J

Jonathan West

Hi Steve,

You do much the same as you have already done, but you set the Wrap property
to wdFindStop. This restricts the replace to the range originally selected.
 
K

Klaus Linke

Hi Steve,

Might be easier to loop the paragraphs in the selection:

Dim p As Paragraph
For Each p In Selection.Paragraphs
p.Range.InsertBefore ChrW(9642) & " "
Next p

If you don't want the bullet to pick up manual formatting from the paragraph,
you'd need to add some code.
Say, set back the first three characters to "Default Paragraph Font".

Regards,
Klaus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top