|
下面是我修改了录制宏的代码
Do
d = InputBox("请输入要替换的内容", "替换")
If d = "" Then Exit Do
Selection.GoTo What:=wdGoToLine, Which:=wdGoToAbsolute, Count:=1
Selection.Find.ClearFormatting
With Selection.Find
.Text = d
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Find.Execute
With Selection.Find
.Text = d
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Loop |
|