繁体   English   中英

Excel 应用程序未从 Outlook VBA 关闭

[英]Excel Application not closing from Outlook VBA

我检查了Excel Application not Closing from Outlook并尝试了投票答案中的解决方案。

为了确保我没有做其他事情,我为 Outlook 编写了最简单的宏,只打开和关闭 Excel。 这不是世界末日,因为这个后台进程几乎不会从 memory 消耗任何东西,但它只会在 Outlook(谁叫它)关闭时关闭。

我把它放在“ ThisOutlookSession ”中:

Public Sub Test()
    MsgBox "Trying"
    Dim exApp As Excel.Application
    Set exApp = Excel.Application
    exApp.EnableEvents = False 'Originally I didn't placed this, but I saw it on the other posts
    exApp.DisplayAlerts = False 'Originally I didn't placed this, but I saw it on the other posts
    exApp.Visible = False 'Originally I didn't placed this, but I saw it on the other posts
    exApp.Quit
    Set exApp = Nothing
    MsgBox "Finished"
End Sub

在 Office 2010 和 2016 上进行了尝试,结果相同。

正如评论中提到的,我只需要在“set exApp = Excel.Application”上使用“CreateObject(”Excel.Application“)”或“New Excel.Aplication”。 两者中的任何一个都可以完美地完成。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM