vb中打开一word文档后,不关闭再次点击打开后出错!

2025-01-24 03:49:46
推荐回答(5个)
回答1:

加NEW关键字
Dim wordDoc As New Word.Document
Dim WordApp As New Word.Application
就可以了
把Set WordApp = CreateObject("Word.Application")去掉,没用

回答2:

用Set wordDoc = getobject(App.Path + "\temp.doc")

回答3:

错误处理
on error resume next 放前面

回答4:

加一句:worddoc.close

回答5:

加NEW关键字
Dim wordDoc As New Word.Document
Dim WordApp As New Word.Application