Home |
Search |
Today's Posts |
#1
|
|||
|
|||
delete duplicate commas
how do I eliminate all commas except one:
the,,,quick,brown..fox...jumps,over,the.....lazy,d og, 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 thanks,,,, |
#2
|
|||
|
|||
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 :-) |
#3
|
|||
|
|||
See http://www.gmayor.com/replace_using_wildcards.htm
Replace ,{1,} with , or by macro Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ",{1,}" .Replacement.Text = "," .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With Selection.Find.Execute replace:=wdReplaceAll -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org macroAddict wrote: how do I eliminate all commas except one: the,,,quick,brown..fox...jumps,over,the.....lazy,d og, 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 thanks,,,, |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to delete a line created by equal signs? It won't delete from | Microsoft Word Help | |||
How do I stop Word from asking Delete Block? | Microsoft Word Help | |||
delete duplicate a tmp file | Microsoft Word Help | |||
Why did "delete" key discontinue to delete a selected word, line . | Microsoft Word Help | |||
i can not use delete key on my key board to delete text | Microsoft Word Help |