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
Jonathan West - 10 Feb 2005 01:13 GMT
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.

Signature
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
> 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
[quoted text clipped - 44 lines]
> Selection.TypeBackspace
> End Sub
Klaus Linke - 10 Feb 2005 03:54 GMT
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
Steven Drenker - 10 Feb 2005 07:28 GMT
Thanks, Klaus...very simple and straightforward.
Steve
> Hi Steve,
>
[quoted text clipped - 11 lines]
> Regards,
> Klaus