且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

运行到错误462:通过Excel VBA处理WORD时,远程服务器机器不存在

更新时间:2023-11-22 07:59:10

您有两个不合格的Word对象引用:

You have two unqualified references to Word objects:

objSelection.Style = ActiveDocument.Styles("Heading 1")

出现两次,需要:

objSelection.Style = objWord.ActiveDocument.Styles("Heading 1")

否则,您将创建一个不能销毁的Word的隐式引用你的代码。

Otherwise you're creating an implicit reference to Word that you can't destroy in your code.