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