1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
Sub Test_V2()
Dim Paragraphe As Paragraph
Dim Texte_A_Reperer As String
Application.ScreenUpdating = False
' demande à l'utilisateur le texte à repérer
Texte_A_Reperer = InputBox("Entrer texte à filtrer :")
'recherche "Texte_A_Reperer" et applique le format "masqué"
For Each Paragraphe In ActiveDocument.Paragraphs
Paragraphe.Range.Select
With Selection
.Find.ClearFormatting
.Find.Replacement.ClearFormatting
.Find.Execute FindText:=Texte_A_Reperer
If .Find.Found = True Then
.HomeKey Unit:=wdLine
.TypeText Text:="25A0"
.ToggleCharacterCode
.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
.Font.Size = 14
.Font.Color = wdColorGreen
.MoveRight Unit:=wdCharacter, Count:=1
.TypeText Text:=" "
.EndKey Unit:=wdLine
End If
End With
Next Paragraphe
Application.ScreenUpdating = True
End Sub |
Partager