View Single Post
  #2   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi ?B?bWFjcm9BZGRpY3Q=?=,

how do I eliminate all commas except one:
the,,,quick,brown..fox...jumps,over,the.....lazy,d og,

HOW doesn't it work. What kind of result are you getting?
And, which version of Word?

right off hand, I'd say you don't need the Do loop, just
Selection.Find with the Replace All. Executing twice (the
first time without specifying replacement text) is probably
driving Word bananas.

this doesn't work:
With ActiveDocument.Content.Find
.ClearFormatting
Do While .Execute(FindText:=",,", Forward:=True, _
Format:=True) = True
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
Loop
End With


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:-)