I
ivanov.ivaylo
Hi all,
I try to adapt a macro to my needs but an error appears. Can you help
me with it?
The macro should search for words and phrases from a list which are
formatted in italic and clolorize them in green and the italic should
be preserved.
Sub Colorize()
Dim sKeywords, i As Integer
sKeywords = Array("adj", "adv", "attr", "aux", "cj", "comp",
"demonstr", "ger", "imp", "impers", "inf", "int", "n", "num", "part",
"pers", "pl", "poss", "pp", "predic", "pref", "prep", "pres p", "pron",
"pt", "refl", "sing", "sl", "o.s.", "o.'s" "v")
For i = LBound(sKeywords) To UBound(sKeywords)
With ActiveDocument.Content.Find
.ClearFormatting
With .Replacement
.ClearFormatting
.Font.Color = wdColorGreen
.Font.Italic = True
End With
.Execute FindText:=sKeywords(i), ReplaceWith:=sKeywords(i), _
Format:=True, MatchCase:=True, Italic:=True,
MatchWholeWord:=True, _
Replace:=wdReplaceAll
End With
Next i
End Sub
I try to adapt a macro to my needs but an error appears. Can you help
me with it?
The macro should search for words and phrases from a list which are
formatted in italic and clolorize them in green and the italic should
be preserved.
Sub Colorize()
Dim sKeywords, i As Integer
sKeywords = Array("adj", "adv", "attr", "aux", "cj", "comp",
"demonstr", "ger", "imp", "impers", "inf", "int", "n", "num", "part",
"pers", "pl", "poss", "pp", "predic", "pref", "prep", "pres p", "pron",
"pt", "refl", "sing", "sl", "o.s.", "o.'s" "v")
For i = LBound(sKeywords) To UBound(sKeywords)
With ActiveDocument.Content.Find
.ClearFormatting
With .Replacement
.ClearFormatting
.Font.Color = wdColorGreen
.Font.Italic = True
End With
.Execute FindText:=sKeywords(i), ReplaceWith:=sKeywords(i), _
Format:=True, MatchCase:=True, Italic:=True,
MatchWholeWord:=True, _
Replace:=wdReplaceAll
End With
Next i
End Sub