aarondewberry
IS-IT--Management
Hi All
I have scrolled my way through many posts and can't seem to find what i'm looking for. Being a VBA novice doesn't help as I'm sure I could possibly adapt another post to what I want. Anyways...
What I am trying to do is find any commas (,) in the first 3 sentences in my word doc. I then want to replace them with nothing. I have this code, which works, but replaces the commas in the whole document.
I only want to replace the commas in the first 3 sentences, and leave the other commas in the sentences after.
Many thanks
I have scrolled my way through many posts and can't seem to find what i'm looking for. Being a VBA novice doesn't help as I'm sure I could possibly adapt another post to what I want. Anyways...
What I am trying to do is find any commas (,) in the first 3 sentences in my word doc. I then want to replace them with nothing. I have this code, which works, but replaces the commas in the whole document.
I only want to replace the commas in the first 3 sentences, and leave the other commas in the sentences after.
Many thanks
Code:
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
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