vba 安排 Outlook 2003 宏
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9226311/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Schedule Outlook 2003 Macro
提问by CompanyDroneFromSector7G
I have an Outlook 2003 macro written in VBA.
我有一个用 VBA 编写的 Outlook 2003 宏。
I would like to schedule it so that it automatically runs at a certain time, say 01:00. The PC is always logged on.
我想安排它以便它在某个时间自动运行,比如 01:00。PC 始终处于登录状态。
I couldn't find anything which suggests how to do this.
我找不到任何建议如何执行此操作的内容。
回答by Matt Donnan
You could create a scheduled task on the PC to run daily at the specific time, and use the Outlook Command Line Switch to start the program and call your macro e.g:
您可以在 PC 上创建计划任务以在特定时间每天运行,然后使用 Outlook 命令行开关启动程序并调用您的宏,例如:
"C:\Program Files\Microsoft Office\Office11\Outlook.exe" /autorun macroname
Update:
更新:
You may be able to use an API call to start a timer to run in the background of outlook, you could combine this with the VB Now() command to get the current time and if greater than your scheduling time you could trigger your macro, the API example can be found here:
您可以使用 API 调用来启动计时器以在 Outlook 后台运行,您可以将其与 VB Now() 命令结合使用以获取当前时间,如果大于您的调度时间,您可以触发您的宏,可以在此处找到 API 示例:
http://www.outlookcode.com/threads.aspx?forumid=4&messageid=22831
http://www.outlookcode.com/threads.aspx?forumid=4&messageid=22831
回答by Nathan Rice
http://support.microsoft.com/kb/237913/EN-US
http://support.microsoft.com/kb/237913/EN-US
This article says it can't be done unless you rewrite it to use CDO.
这篇文章说除非你重写它以使用CDO,否则它无法完成。
Sorry.
对不起。