S
Sandusky
I have a document in which every paragraph ends in a comma. I'd like
to replace that comma with a period. How to do this? Is the paragraph
symbol, even though it isn't visible, considered a character of the
paragraph? I was trying to do something like this:
Dim sel As Selection, rng As Range
Set sel = Selection
Set rng = sel.Range
Dim pgs As Paragraphs
Set pgs = rng.Paragraphs
Dim pg As Paragraph, txt As String
Dim i As Long
For i = 1 To pgs.Count
Set pg = pgs(i)
txt = pg.Range.Text
If Right(txt, 1) = "," Then
'do something
pg.Range.Text = newtextvalue
End If
Next i
to replace that comma with a period. How to do this? Is the paragraph
symbol, even though it isn't visible, considered a character of the
paragraph? I was trying to do something like this:
Dim sel As Selection, rng As Range
Set sel = Selection
Set rng = sel.Range
Dim pgs As Paragraphs
Set pgs = rng.Paragraphs
Dim pg As Paragraph, txt As String
Dim i As Long
For i = 1 To pgs.Count
Set pg = pgs(i)
txt = pg.Range.Text
If Right(txt, 1) = "," Then
'do something
pg.Range.Text = newtextvalue
End If
Next i