Sub Macro1() Dim MyArray As Variant, i As Integer MyArray = Array("RO", "PS", "PO") For i = 0 To UBound(MyArray) With Selection.Find .ClearFormatting .Replacement.ClearFormatting .Text = MyArray(i) Select Case .Text Case "RO" .Replacement.Text = "Roman" Case "PS" .Replacement.Text = "Poésie" Case "PO" .Replacement.Text = "Policier" End Select .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = True .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute Replace:=wdReplaceAll End With Next i End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionSet mondico = CreateObject("Scripting.Dictionary") mondico.Add "RO", "Roman" mondico.Add "PS", "Poésie" mondico.Add "PO", "Policier" For Each mot In mondico With Selection.Find .ClearFormatting .Replacement.ClearFormatting .Text = mot .Replacement.Text = mondico(mot) .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = True .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False .Execute Replace:=wdReplaceAll End With Next