Hi again,
try this:
Sub French()
Dim rDcm As Range
Dim rTmp As Range
Dim sTmp As String
Dim pos1 As Long
Dim pos2 As Long
Set rDcm = ActiveDocument.Range
Set rTmp = selection.Range
With rDcm.Find
.Text = "$[0-9]{1,}"
.MatchWildcards = True
While .Execute
rDcm.Select ' only for testing [F8]
pos1 = rDcm.start
rTmp.start = pos1
rTmp.End = ActiveDocument.Range.End
With rTmp.Find
.Text = "[!0-9,.$]"
.MatchWildcards = True
If .Execute Then
rTmp.Select ' only for testing [F8]
pos2 = rTmp.End - 1
rTmp.start = pos1
rTmp.End = pos2
rTmp.Select ' only for testing [F8]
sTmp = rTmp.Text
sTmp = Replace(sTmp, ",", Chr(160))
' non breaking spaces everywhere !
sTmp = Replace(sTmp, ".", ",")
sTmp = Right(sTmp, Len(sTmp) - 1)
sTmp = sTmp & Chr(160) & "$"
rTmp.Text = sTmp
End If
End With
Wend
End With
End Sub
There might be some redundancy in the code.
Just the way it is with the first attempt.
The code searches for a $-sign followed by one or more digits.
It remembers the postition, where where "$[0-9]{1,}" was found.
It then searches for a character not equal to
on of those 0 til 9 , . $
It remembers that position (pos2).
It sets a range from pos1 to pos2 -1.
The contents of that range are processed
in the variable stmp.
Kommas are replaced by non-breaking spaces chr(160).
The period is replaced by a komma.
The leading $-sign is cut off.
A non-breaking space and a $-sign are added at the end of stmp.
The range defined by pos1 and pos2 is set to stmp.
Voilá.
Lines marked by ' only for testing [F8]
can be deleted if everything is working alright.
--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"