1
我有以下脚本,它将查找一个句点,后面跟着2个或更多个空格,但我要查找的是能够查找第一个单词的单词句子,如果它是“医疗”,那么它会改变它。我希望能够利用这个脚本,但我已经可以告诉它是否会是错过的段落的第一个单词,我不知道如何正确搜索“医疗”如何在单词中搜索句子的第一个单词
With Selection.Find
.ClearFormatting
.Highlight = False
.Replacement.ClearFormatting
.Replacement.Highlight = True
.Text = (\.)({2,9})
.Replacement.Text = "\1 "
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With
我最终找到另一篇文章在link以及与此想出了:
Dim i As Integer
Dim doc As Document
Set doc = ActiveDocument
For i = 1 To doc.Sentences.Count
If doc.Sentences(i).Words(1) = "Medical " Then
doc.Sentences(i).Words(1) = "Medical (needs removal) "
End If
If doc.Sentences(i).Words(1) = "Dental " Then
doc.Sentences(i).Words(1) = "Dental (needs removal) "
End If
If doc.Sentences(i).Words(1) = "Life " Then
doc.Sentences(i).Words(1) = "Life (needs removal) "
End If
If doc.Sentences(i).Words(1) = "Vision " Then
doc.Sentences(i).Words(1) = "Vision (needs removal) "
End If
Next
感谢您的回复! – MBlackburn
你能看看这篇文章吗? [链接](http://stackoverflow.com/questions/10711764/vba-word-find-hyperlinks-if-not-arial-10pt-blue) – MBlackburn