如何使用Excel VBAclosures手动打开的Word文档

在运行excel vba代码之前,我已经手动打开了Word文档,是否可以closures通过Excel VBA打开的特定Word文档

假设你在Word应用程序中没有挂钩,像这样的东西应该可以做到这一点:

Set wordApp = GetObject(, "Word.Application") For Each wdDoc In wordApp.Documents If wdDoc.Name = "close_me.docx" Then '// rename to your doc wdDoc.Close SaveChange:=False '// change to true if required DoEvents Exit For End If Next