Sub Test_pmo()
Dim xlApp As Object
Chemin = Me.Path
Fichier = "TARIF CODE.xls"
Dim nbChar1& 'ajout pmo
Dim nbChar2& 'ajout pmo
Set xlApp = CreateObject("excel.application")
xlApp.Visible = False
Set MonFichier = xlApp.Workbooks.Open(FileName:=Chemin & "\" & Fichier)
Set MaZone = MonFichier.sheets("Feuil1").Range("A2", _
MonFichier.sheets("Feuil1").Range("A65536").End(-4162))
For Each x In MaZone
Selection.HomeKey Unit:=wdStory
With Selection.Find
nbChar1& = Len(Trim(x)) 'ajout pmo
.Text = x
.MatchWholeWord = True
nbChar2& = Len(Trim(CStr(x.Offset(0, 1)))) 'ajout pmo
.Replacement.Text = Space(nbChar1& - nbChar2&) & x.Offset(0, 1) 'modif pmo
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next
xlApp.Quit
Set xlApp = Nothing
End Sub