0
我試圖遍歷所有這些都沒有一個表中的段落並突出顯示文本,例如:查找和選擇內更換是更換整個文檔
'Iterate All Paragraphs
Dim p
objWord.Options.DefaultHighlightColorIndex = finalColor
For Each p In objDoc.Paragraphs
p.Range.Select
If Not objWord.Selection.Information(wdWithInTable) Then
With objWord.Selection.Range.Find
.ClearFormatting
.Highlight = False
.Forward = True
.Wrap = wdFindStop
.Replacement.ClearFormatting
.Replacement.Highlight = True
.Execute , , , , , , True, wdFindStop, , , wdReplaceAll
End With
End If
Next
條件objWord.Selection.Information(wdWithInTable)
作品就好了,然而,即使在表格中,查找/執行也會替換整個文檔中的所有非高亮文本。
任何猜測爲什麼?