|
请备份原文件后试用:
Sub test()
'替换(A)为(?)
With ActiveDocument.Content.Find
.Execute FindText:="^l", replacewith:="^p", Replace:=wdReplaceAll '手动换行符=>段落标记(全部替换)
.Execute FindText:="^13", replacewith:="^p", Replace:=wdReplaceAll '真假回车符=>段落标记(全部替换)
.Execute FindText:="(", replacewith:="(", Replace:=wdReplaceAll
.Execute FindText:=")", replacewith:=")", Replace:=wdReplaceAll
End With
Dim i As Paragraph
For Each i In ActiveDocument.Paragraphs
i.Range.Select
Selection.Find.Execute FindText:="(", Forward:=True, Wrap:=wdFindStop
If Selection.Find.Found = True Then
Do
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
If Selection.Characters.Last.Text = ")" Then Exit Do
Loop
Selection.Font.Color = wdColorRed '红色(此语句可注释掉)
Selection.Text = "( ? )"
Else
Selection.EndKey Unit:=wdLine
End If
Next
Selection.HomeKey Unit:=wdStory
End Sub |
|