Bonjour
j'essaie de traiter en liste le surlignage de certains caractères à fin de contrôle d'italique
objectif : les caractéres ( ) [ ] { } guillemets apostrophes, guillemets français etc. seront surlignés rouge si leur police est italique et vert s'ils sont droits = romain

actuellement je traite chaque cas un par un et c'est lourd... dès que j'aurai la procédure, je vais l'appliquer à une multitude de mes recherches !

mon besoin est de traiter en liste à partir de RR comme ci-dessous, car je ne sais faire que du Rechercher-Remplacer
voici donc là ou je dois apprendre les variables string etc. appliquées à ce vba Word.
je ne trouve des explications qu'avec du Range d'excel et je ne peux pas comprendre

merci de m'aider, ça fait des heures que je fouille le net, cordialement

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
' 1.1. « italique
    Options.DefaultHighlightColorIndex = wdYellow
    Selection.Find.ClearFormatting
    Selection.Find.Font.Italic = True
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Highlight = True
 
    With Selection.Find
        .Text = "^0145"
        .Replacement.Text = "^&"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
      Selection.Find.Execute Replace:=wdReplaceAll
 
' 1.2. » italique
    Options.DefaultHighlightColorIndex = wdRed
    Selection.Find.ClearFormatting
    Selection.Find.Font.Italic = True
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Highlight = True
 
    With Selection.Find
        .Text = "^0146"
        .Replacement.Text = "^&"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
 
' 1.3. « droite
    Options.DefaultHighlightColorIndex = wdYellow
    Selection.Find.ClearFormatting
    Selection.Find.Font.Italic = False
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Highlight = True
 
    With Selection.Find
        .Text = "^0145"
        .Replacement.Text = "^&"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
 
' 1.4. » droite
    Options.DefaultHighlightColorIndex = wdGreen
    Selection.Find.ClearFormatting
    Selection.Find.Font.Italic = False
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Highlight = True
 
    With Selection.Find
        .Text = "^0146"
        .Replacement.Text = "^&"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
 
'222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
 
 ' 2. - guillemets double apostrophes - "  "
 
' 5.1. " italique
    Options.DefaultHighlightColorIndex = wdRed
    Selection.Find.ClearFormatting
    Selection.Find.Font.Italic = True
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Highlight = True
 
    With Selection.Find
        .Text = "^0147"
        .Replacement.Text = "^&"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
      Selection.Find.Execute Replace:=wdReplaceAll
 
' etc.
' bonne journée !