1

I got a macro need to execute by window scheduler for difference batch jobs task. I did completed for execute macro in excel by wrote vbs & .bat. However I can't use same method for outlook

Dim objOutlook As Outlook.Application
Set objOutlook = CreateObject("outlook.Application")
objoutlook.Application.Run "CopyToExcel"
objoutlook.Application.Quit
Set objoutlook = Nothing

Is it possible to do so ? please advise.

  • 1
    Possible duplicate of [Call Outlook procedure using VBScript to be used in Task Scheduler](http://stackoverflow.com/questions/21179750/call-outlook-procedure-using-vbscript-to-be-used-in-task-scheduler) – niton Feb 02 '16 at 12:10

1 Answers1

0

I'd recommend using Extended MAPI or any other wrapper around that API such as Redemption.

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution. Read more about that in the Considerations for server-side Automation of Office article.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45