当在“任务计划程序"中显示“运行用户是否未登录"时,Excel VBA脚本不会发送Outlook项目.被选中 [英] Excel VBA script does not send Outlook items when in Task Scheduler and "Run whether user is logged on on not" is selected
问题描述
我在网络环境中使用MS Office 2013和Windows 7.我有一个自动打开的Excel VBA程序,该程序通过Outlook发送文件,并通过任务计划程序进行计划.当我使用MS Office 2010时,此程序运行得很好,但是我的计算机已擦除并重新安装了MS2013.一些关键点:
I use MS Office 2013 and Windows 7 in a networked environment. I have an auto-open Excel VBA program that sends files via Outlook and is scheduled via Task Scheduler. This ran perfectly when I was on MS Office 2010, but my computer was wiped and reinstalled with MS 2013. Some key points:
-
当我直接运行Excel文件并通过Outlook发送电子邮件时,Excel文件全部正常工作.
The Excel files all work when I run them directly and the emails get sent via Outlook.
当我使用仅在用户登录时运行"设置并且通过Outlook发送电子邮件时,任务计划程序才能工作.
Task Scheduler works when I use the setting "Run only when user is logged on" and emails get sent via Outlook.
任务计划程序以无论用户是否登录都运行"运行,但与Excel VBA的其他部分协同工作,但未成功发送Outlook文件.我知道这一点是因为我包含了将文件保存在特定目录中的一行,并且确实将其保存在该目录中.我还在任务管理器进程中看到了Excel.因此它可以运行,但不会发送Outlook电子邮件.
Task Scheduler works with the other parts of the Excel VBA when it runs as "Run whether user is logged on or not," but does not successfully send Outlook files. I know this because I included a line to save a file in a particular directory and it did save it there. I also saw Excel in the Task Manager processes. So it runs, but does not send the Outlook email.
我已经尝试过的东西: 1.更改了Microsoft Excel和Outlook邮件附件的DCOM设置 2.创建"C:\ Windows \ System32 \ config \ systemprofile \ Desktop"和"C:\ Windows \ SysWOW64 \ config \ systemprofile \ Desktop"目录
Things I have tried already: 1. Changed DCOM settings for Microsoft Excel and Outlook Message Attachment 2. Created "C:\Windows\System32\config\systemprofile\Desktop" and "C:\Windows\SysWOW64\config\systemprofile\Desktop" directories
推荐答案
不支持在任务计划程序中或Windows Service上下文中使用Outlook对象模型,因此这可以解释某些意外行为.请参阅: https://support.microsoft.com/zh-cn/help/237913/the-outlook-object-model-is-unsuitable-to-run-in-a-windows-service
Using the Outlook Object Model in a Task Scheduler or in the context of a Windows Service is not supported, so this could explain some of the unexpected behaviour. See: https://support.microsoft.com/en-ca/help/237913/the-outlook-object-model-is-unsuitable-to-run-in-a-windows-service
这篇关于当在“任务计划程序"中显示“运行用户是否未登录"时,Excel VBA脚本不会发送Outlook项目.被选中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!