且构网

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

错误462:通过Excel VBA使用Word时,远程服务器计算机不存在

更新时间:2023-11-22 08:08:28

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

You have two unqualified references to Word objects:

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

出现两次的

必须是:

which appears twice, needs to be:

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.