更新时间: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.