I'm struggling to get this Find / Replace to work. It's to try and remove any spaces after a comma when monetry values are found.
Such as this £45, 000 should become thus £45,000 and
£125, 643 should become thus £125,643
Everything I have tried so far either leaves things as per the original state, or removes the preceding numbers and one of the trailing numbers.
Here's what I have:-
Private Sub FixSpacing(CCtrl As ContentControl)
Dim oRng As Range
With CCtrl
Select Case .Type
Case wdContentControlText, wdContentControlRichText
Set oRng = .Range
With oRng
' Remove trailing spaces
Do While .Characters.Last = " "
.Characters.Last.Text = vbNullString
Loop
.End = .End - 1
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Format = False
.Wrap = wdFindStop
.MatchWildcards = True
' Remove single space after comma if it is preceded by a number
.Text = "([0-9],[^s])"
.Replacement.Text = ","
.Execute Replace:=wdReplaceAll
End With
End With
Case Else
End Select
End With
lbl_Exit:
Exit Sub
End Sub