I want to replace multiple text / punctuation marks for example
","
with " "
"'s"
with " "
,
's
are Extra text which I do not need for next step.
Replace
method can change only one time
Is there any other way to replace multiple text from the following sentence?
"Aabar remains focused on Abu Dhabi’s plans expansion, In Dubai ahead of Expo 2020"
Replace
works with ,
but 's
is still there.
Sub make_range_replace_string()
Dim R As Range
Dim F As String
Do
selection.Find.ClearFormatting
selection.Find.Font.Bold = True
With selection.Find
.Forward = True
.Wrap = wdFindStop
End With
selection.Find.Execute
If selection.Find.Found Then
Set R = ActiveDocument.Range(selection.Range.Start, selection.Range.End)
F = Replace(R, ",", "")
MsgBox F
Else
Exit Do
End If
Loop
End Sub
Doug Glancey is correct, just use ’ instead of ' though. In other words; use the Replace-function multiple times.
Dim F As String
F = "Aabar remains focused on Abu Dhabi’s plans expansion, In Dubai ahead of Expo 2020"
F = Replace(F, ",", " ")
F = Replace(F, "`s", " ")
F = Replace(F, "’s", " ")
F = Replace(F, "'s", " ")
F = Replace(F, Chr(39) & "s", " ")
F = Replace(F, Chr(96) & "s", " ")
MsgBox F