Dim app As New MSWord.Application
try
Dim doc = app.Documents.Open("D:\02collectdata\课程文章\wj.doc")
app.Selection.Find.Text = "^l"
app.Selection.Find.Replacement.ClearFormatting()
app.Selection.Find.Replacement.Text = "^p"
app.Selection.Find.Execute(Replace:=MSWord.WdReplace.wdReplaceAll)
doc.save
app.Selection.Find.Text = "^p^p"
app.Selection.Find.Replacement.ClearFormatting()
app.Selection.Find.Replacement.Text = "^p"
app.Selection.Find.Execute(Replace:=MSWord.WdReplace.wdReplaceAll)
app.visible = True
catch ex As exception
msgbox(ex.message)
app.Quit
finally
End try
老师,上面代码,我做了两次替换,但是只是第一次可以成功,如果注释掉任何一个替换都可正常运行,就是两个同时运行时,只运行第一个,老师怎么才可以做多次查找替换