有没有人知道为什么我会在每次循环到下一个循环时在任务管理器中获得运行单词的后台进程?感谢。
Try
For Each element In Raneeded
If Not String.IsNullOrEmpty(element) Then
Dim OpenRA = New Microsoft.Office.Interop.Word.Application
docname = d(CInt(element)) & ".docx"
OpenRA.Documents.Open(folderpath & docname)
OpenRA.Visible = False
Dim opened1 = OpenRA.ActiveDocument
Dim RAtable As Word.Table = opened1.Tables(1)
RAtable.Cell(1, 1).Range.Text = "Site Address: " & address
opened1.Close()
End If
Next
Catch ex As Exception
MsgBox(ex.Message & " Please contact your system Administrator, quoting these details.")
End Try
答案 0 :(得分:1)
你关闭了doc,但是从不关闭aplication这个词,要么在循环外定义它,要么在结束时关闭它,要么在关闭doc时关闭它们
opened1.Save()
OpenRA.Quit()