如何在段落中选择两个单词VBA
我有一段文字包含: “b)美国之音/A VergabeverfahrenÖffentliche Ausschreibung VergabeverfahrenÖffentliche 13A0295S。” 是否可以在本段中同时选择以下两个单词 “b)Vergabeverfahren”和“VergabeEnumer” 原因是我想将选择颜色更改为红色。我可以使用此代码成功选择一个单词。但选择两个词对我来说有点问题 这是我的密码:如何在段落中选择两个单词VBA,vba,ms-word,Vba,Ms Word,我有一段文字包含: “b)美国之音/A VergabeverfahrenÖffentliche Ausschreibung VergabeverfahrenÖffentliche 13A0295S。” 是否可以在本段中同时选择以下两个单词 “b)Vergabeverfahren”和“VergabeEnumer” 原因是我想将选择颜色更改为红色。我可以使用此代码成功选择一个单词。但选择两个词对我来说有点问题 这是我的密码: Selection.Start = singleLine.range.St
Selection.Start = singleLine.range.Start
Selection.End = singleLine.range.End
ReplaceText = StrFrmDll ' StrFrmDll contains the paragraph.
Selection.Find.ClearFormatting
With Selection.Find
.Text = ReplaceText
.Replacement.Text = ReplaceText
.Replacement.Font.Hidden = True
.ClearFormatting
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
End With
Selection.Find.Execute Replace:=wdReplaceOne
Selection.Font.Color = wdColorRed
只需做两个选择。查找
Selection.Find.ClearFormatting
With Selection.Find
.Text = Vergabeverfahren
.Replacement.Font.Hidden = True
.ClearFormatting
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
End With
Selection.Find.Execute Replace:=wdReplaceOne
Selection.Font.Color = wdColorRed
Selection.Find.ClearFormatting
With Selection.Find
.Text = Vergabenummer
.Replacement.Font.Hidden = True
.ClearFormatting
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
End With
Selection.Find.Execute Replace:=wdReplaceOne
Selection.Font.Color = wdColorRed